DevelopPHP.com 2011 Forum Discussion(not active)


as3 frame script scenes
May 03, 2011 DigitalNinja wrote:
Hi

im trying to figure out the as3 script to add to a frame to so that when the time line hits that frame
it tells it to load a specific scene.

can anyone help?

Re:as3 frame script scenes
May 03, 2011 rmazook responded with:
On the frame you want to load the new scene, just put in gotoAndPlay(frameNumber);
Re:as3 frame script scenes
May 03, 2011 DigitalNinja responded with:
thanks but its not a frame i want to load its a scene within the fla and its as3 surly its not as simple as gotoAndPlay?
Re:as3 frame script scenes
May 04, 2011 DigitalNinja responded with:
found this code which i put into the frame, so that when the timeline hits it, it will jump to the "About" scene frame "1"

stop ();
this.addEventListener (Event.ENTER_FRAME, EnterFrame);
EnterFrame function (event: Event): void (
gotoAndPlay (1, "About");
)

but im getting these errors....any advice?

Symbol 'home_holder_mc', Layer 'actions', Frame 3, Line 3    1084: Syntax error: expecting identifier before leftparen.
Symbol 'home_holder_mc', Layer 'actions', Frame 3, Line 3    1084: Syntax error: expecting leftparen before colon.
Symbol 'home_holder_mc', Layer 'actions', Frame 3, Line 4    1084: Syntax error: expecting rightparen before leftparen.
Symbol 'home_holder_mc', Layer 'actions', Frame 3, Line 5    1084: Syntax error: expecting identifier before rightparen.


Re:as3 frame script scenes
May 04, 2011 rmazook responded with:
Use a different function name.  EnterFrame is sort of already a reserved syntax in AS3.  In this example I renamed your function playAbout.  And you need to put function before the name of your function like this:

stop ();
this.addEventListener (Event.ENTER_FRAME, playAbout);
function 
playAbout(event: Event): void (
gotoAndPlay (1, "About");
)

The syntax error is because you had the name of the function before claiming it as a function.  Always say:

function  whateverName(event:Event):void

Hope this helps.  :)
Re:as3 frame script scenes
May 04, 2011 rmazook responded with:
Oh also, I just noticed you want to use curly braces not parenthesis after :void.  I just copied your function so what I have up top is wrong.  Here's the correct function.  You can copy and paste this and it should work:

stop();

this.addEventListener(Event.ENTER_FRAME, playAbout);

function playAbout(event:Event):void{
gotoAndPlay ("About");  /// here you go to and play the frame label about.  If you don't have a label then use frame number
}
Re:as3 frame script scenes
May 05, 2011 DigitalNinja responded with:
sorted, much appreciated :)

©2011 DevelopPHP.com