List Info

Thread: Using actionscript to go to a frame




Using actionscript to go to a frame
country flaguser name
Canada
2007-08-31 13:57:14
Hi there..

I'm trying to develop a very simple movie controller that
will load a 
movie and then go to frame 5.  Everything works well if I
add a 
button to the stage using the following code.

I first load my movie:

loadMovie("webinar2.swf", phone);
//there is not a stop(); in frame1

Then I have a button with the following actionscript:

on (release) {
	//stop the movie
	phone.stop();
	phone.gotoAndStop(5);
};


My question is why must I use a button to move to frame 5? I
would 
like to load the movie and go to frame 5 automatically. 
Unfortunately, my movie does not go to frame 5 & stop
there if I 
simply use

loadMovie("webinar2.swf", phone);
phone.stop();
phone.gotoAndStop(5);

What am I missing?... Thanks for any help... dave
-- 
_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

RE: Using actionscript to go to a frame
country flaguser name
United States
2007-08-31 19:23:09
The loadMovie() function is asynchronous, so your script
doesn't sit and
wait for the movie to load before it continues. The script
keeps chunking
along. It's likely that the stop() and gotoAndStop(5) calls
are executing
before your SWF is loaded and initialized (ready for
action). 

Instead utilize a movieClipLoader object with a listener to
trigger the
actions you want done on the newly loaded movie clip *after*
it is loaded
and init'ed. This way you can control WHEN the actions are
triggered. Such
as....

this.createEmptyMovieClip("phone_mc",
this.getNextHighestDepth());

var mcListener:Object = new Object();
mcListener.onLoadInit = function(target_mc:MovieClip) {
	target_mc.stop();
	target_mc.gotoAndStop(5);
};

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(mcListener);
mcLoader.loadClip("webinar2.swf", phone_mc);
 
...Rob


-----Original Message-----
From: Dave Williams [mailto:daveconferencevillage.com] 
Sent: Friday, August 31, 2007 2:57 PM
To: Flashnewbie Mailing List
Subject: [Flashnewbie] Using actionscript to go to a frame

Hi there..

I'm trying to develop a very simple movie controller that
will load a movie
and then go to frame 5.  Everything works well if I add a
button to the
stage using the following code.

I first load my movie:

loadMovie("webinar2.swf", phone);
//there is not a stop(); in frame1

Then I have a button with the following actionscript:

on (release) {
	//stop the movie
	phone.stop();
	phone.gotoAndStop(5);
};


My question is why must I use a button to move to frame 5? I
would like to
load the movie and go to frame 5 automatically. 
Unfortunately, my movie does not go to frame 5 & stop
there if I simply use

loadMovie("webinar2.swf", phone);
phone.stop();
phone.gotoAndStop(5);

What am I missing?... Thanks for any help... dave
--


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

RE: Using actionscript to go to a frame
country flaguser name
Canada
2007-09-01 10:52:50
Thanks very much... you were right.... I need to add an
event listener.

Your code is terrific but unfortunately I need to use
Actionscript 
1.... how would I accomplish the same thing with the
"old school" 
techniques?

thanks... dave

At 8:23 PM -0400 8/31/07, Hairy Dog Digital wrote:
>The loadMovie() function is asynchronous, so your script
doesn't sit and
>wait for the movie to load before it continues. The
script keeps chunking
>along. It's likely that the stop() and gotoAndStop(5)
calls are executing
>before your SWF is loaded and initialized (ready for
action).
>
>Instead utilize a movieClipLoader object with a listener
to trigger the
>actions you want done on the newly loaded movie clip
*after* it is loaded
>and init'ed. This way you can control WHEN the actions
are triggered. Such
>as....
>
>this.createEmptyMovieClip("phone_mc",
this.getNextHighestDepth());
>
>var mcListener:Object = new Object();
>mcListener.onLoadInit = function(target_mc:MovieClip) {
>	target_mc.stop();
>	target_mc.gotoAndStop(5);
>};
>
>var mcLoader:MovieClipLoader = new MovieClipLoader();
>mcLoader.addListener(mcListener);
>mcLoader.loadClip("webinar2.swf", phone_mc);
>
>...Rob
>
>
>-----Original Message-----
>From: Dave Williams [mailto:daveconferencevillage.com]
>Sent: Friday, August 31, 2007 2:57 PM
>To: Flashnewbie Mailing List
>Subject: [Flashnewbie] Using actionscript to go to a
frame
>
>Hi there..
>
>I'm trying to develop a very simple movie controller
that will load a movie
>and then go to frame 5.  Everything works well if I add
a button to the
>stage using the following code.
>
>I first load my movie:
>
>loadMovie("webinar2.swf", phone);
>//there is not a stop(); in frame1
>
>Then I have a button with the following actionscript:
>
>on (release) {
>	//stop the movie
>	phone.stop();
>	phone.gotoAndStop(5);
>};
>
>
>My question is why must I use a button to move to frame
5? I would like to
>load the movie and go to frame 5 automatically.
>Unfortunately, my movie does not go to frame 5 &
stop there if I simply use
>
>loadMovie("webinar2.swf", phone);
>phone.stop();
>phone.gotoAndStop(5);
>
>What am I missing?... Thanks for any help... dave
>--
>

-- 
_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )