PDA

View Full Version : phantom as3 syntax error


teamchuck
12-24-2008, 04:45 PM
I have two frames within my movie each containing code. When I try to run my movie I get an error "1084: Syntax error: expecting rightbrace before end of program."

Location - "Scene 1, Layer 'functionality', Frame 2"

I have no idea what the syntax error is.

import gs.TweenMax;
import gs.easing.*;

var mc_loader:Loader = new Loader();
var external:URLRequest;
var fade:Number = 0.5;

function fadeLoader() {
TweenMax.to(mc_loader, fade,{alpha:0,onComplete:startLoad});
}

mc_loader.contentLoaderInfo.addEventListener(Progr essEvent.PROGRESS, loadProgress);
mc_loader.contentLoaderInfo.addEventListener(Event .COMPLETE, loadComplete);

addChild(mc_loader);
//setChildIndex(mc_loader,getChildIndex(menu));

function loadComplete(e:Event):void {
preLoader.visible = false;
mc_loader.alpha = 1;
}
function loadProgress(e:Event):void {
preLoader.visible = true;
var pcent:Number=e.bytesLoaded/e.bytesTotal*100;
preLoader.lbar.scaleX=pcent/100;
preLoader.lpc.text=int(pcent);
}
function startLoad():void {
try {
external=new URLRequest(whichCat.src);
mc_loader.unload();
mc_loader.load(external);
} catch (error:Error) {
trace("Error catch: " + error);
} finally {
trace(whichCat.src);
trace("Finally!");
}
}

Getting very frustrated as this error just appeared. I commented out all code. Still got the error. I deleted the frame...the error location changed to a different page containing this code:

import gs.TweenMax;
import gs.easing.*;

var whichCat:Array = new Array;
var tempCat:Array = new Array;
var newTitle:String;

// CUSTOM UTILITIES
function replace(str, find, replace) {
return str.split(find).join(replace);
}
function toTitleCase(str) {
return str.substr(0,1).toUpperCase() + str.substr(1);
}
function formatTitle(title) {
return 'The Window People' + title != ' /'?' / ' + toTitleCase(replace(title.substr(1,title.length - 2),'/',' / ')):'';
}

//SWFADDRESS ACTIONS
function btnClick(e:MouseEvent):void {
tempCat.deepLink = e.currentTarget.deepLink;
tempCat.src = e.currentTarget.src;
tempCat.name = e.currentTarget.name;
SWFAddress.setValue(e.currentTarget.deepLink);
}
function btnRollOver(e:MouseEvent):void {
SWFAddress.setStatus(e.currentTarget.deepLink);
TweenMax.to(e.currentTarget, 0.25,{tint:0x5ca7ba});

function btnRollOut(e:MouseEvent):void {
SWFAddress.resetStatus();
TweenMax.to(e.currentTarget, 0.25,{tint:0xffffff});
}

// SWFAddress handling
function handleSWFAddress(e:SWFAddressEvent) {
var pageValue:String = e.value;
if (pageValue == '/') {
pageValue = '/home/';
tempCat.deepLink = pageValue;
tempCat.src = 'mc_home.swf';
tempCat.name = 'btn_category0';
}
for (var i:int=0; i < buttons.length; i++) {
var btn:MovieClip=buttons[i];
if (pageValue != btn.deepLink) {
enableBtnProps(btn);
TweenMax.to(btn, 0.25,{tint:0xffffff});
} else {
disableBtnProps(btn);
TweenMax.to(btn, 0.25,{tint:0x5ca7ba});
whichCat.deepLink = tempCat.deepLink;
whichCat.src = tempCat.src;
whichCat.name = tempCat.name;
fadeLoader();
SWFAddress.setTitle('The Window People'+whichCat.deepLink);
}
}
}
SWFAddress.addEventListener(SWFAddressEvent.CHANGE , handleSWFAddress);

I can't for the life of me find where the problem is...any suggestions?

stolex
12-24-2008, 06:32 PM
Your function:

function btnRollOver(e:MouseEvent):void {
SWFAddress.setStatus(e.currentTarget.deepLink);
TweenMax.to(e.currentTarget, 0.25,{tint:0x5ca7ba});

doesn't finished with "}" before you start next function "function btnRollOut(e:MouseEvent):void {"

teamchuck
12-24-2008, 06:50 PM
Oh that is beyond frustrating. I built that function a week ago. I wonder how I removed the '}'...

Whatever happened, thanks, I have been looking at the code for the past three hours trying to figure out where the error is.