PDA

View Full Version : Why do I get '{' expected


tally622
02-17-2008, 02:09 PM
Good Morning All. I am brand new to ActionScript so I KNOW this is a stupid question. I have been charged with creating flash banners for my boss. I have done one and added a URLRequest just fine. When I tried to add same script to next banner I keep getting a '{' expected error. I have worked on this for 2 hours now and simply cannot see any difference between the 2. Why would 1 work and the other not?

travikk
02-17-2008, 02:31 PM
Give us some code so we can help you.

tally622
02-17-2008, 02:45 PM
Thanks a lot for responding. The code is short so I'll post it here. The first one that worked is:

var link:URLRequest = new

URLRequest("http://www.salesquenchers.com");
var colorA:ColorTransform = new ColorTransform;
hidden_mc.addEventListener(MouseEvent.CLICK, oneClick);

function oneClick(event:MouseEvent):void
{
navigateToURL(link);
colorA.alphaOffset = -255;
hidden_mc.transform.colorTransform = colorA;

inv_btn.scaleX = 200;
inv_btn.scaleY = 200;
hidden_mc.buttonMode = false
}


hidden_mc.enabled = true
hidden_mc.buttonMode = true
var colorT:ColorTransform = new ColorTransform;

inv_btn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void
{
colorT.alphaOffset = 100;
hidden_mc.transform.colorTransform = colorT;
hidden_mc.buttonMode = true
inv_btn.scaleX = .02;
inv_btn.scaleY = .02;
}


The second, I simply created the new button and movie clip (hidden_mc) and copy and pasted the code. When I started getting the error I reduced it to this:

var link:URLRequest = new URLRequest("http://www.salesquenchers.com");
inv_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
navigateToURL(link);
}

I get same error.


EDIT
Please put Actionscript code in [ as ] [ /as ] tags (without spaces)

panel
02-17-2008, 03:11 PM
Code is ok, so problem have to be elsewere

coreman2200
02-17-2008, 03:51 PM
Yeah the code's fine. Maybe you have a closing bracket for say a package or something and maybe forgot the opening one? Or maybe a class. Whatever the case its 'outside' of this provided code where you're having the problem. Good luck on the search - in my worst of times I've spent at least an hour looking through code to find, at the brink of total maniacal insanity and violent destructive rage, that it had been some stupid, small problem like the ones I detailed above. lol. But I'm amazingly mentally hilarious, for a programmer.. :)

tally622
02-17-2008, 05:57 PM
There is no other code. Do you think that it could be in the version saved in or some other obvious thing I'm not seeing? Is there a way to send the 2 .fla files for someone to look at? This is very frustrating getting one to work perfectly and then get stopped dead by such a silly thing.

panel
02-18-2008, 09:58 AM
You can zip them and attach here