Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » Using a variable in GotoandPlay()


Using a variable in GotoandPlay()

Reply
  #1 (permalink)  
Old 04-18-06, 09:30 AM
cgourlay cgourlay is offline
New Member
 
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Using a variable in GotoandPlay()

Hi, I have the following code:

var s;
s = "4";
gotoAndPlay("Scene s", 1);

Basically, I need to use a variable to tell it what scene to play. What is the correct sytax to call a variable here? I'm new to actionscript.

Better yet, maybe someone could tell me the best way to accomplish this. I will have a movie with 25 scenes, but every few scenes, I want the movie to play scene 2 again. At scene 2, I will have a script to tell the movie what scene it was on when it came back to 2. In other words, it should play like this: scene 1, scene 2, scene 3, scene 4, scene 5, scene 2, scene 6, scene 7 etc.

Thanks for any input you have.
Reply With Quote
  #2 (permalink)  
Old 05-03-06, 01:00 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
gotoAndPlay("scene"+s, 1);
should work: it's just as all the other string additions

just use an if statement to check if the page number is 5, and then redirect to scene 2. then send some other boolean with it (value = true). and check in scene 2 whether the boolean is true or false, case true: redirect to scene 6, case false: redirect to scene 3

Greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks


Last edited by UnrealEd; 05-03-06 at 01:03 PM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
templating problem (how to forward file name as a variable) skyrat PHP 0 09-11-05 08:27 PM
using variable variables with multiple variables for parts of the name harlock PHP 7 07-26-05 07:35 PM
what is the best method to find last word in variable ? GS300 PHP 6 09-15-04 09:13 PM
javascript variable passed to JSP workaround! peejay Everything Java 0 08-05-04 12:41 AM
Call a variable name dynamically Kenrette ASP 2 11-12-03 09:48 AM


All times are GMT -5. The time now is 06:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.