Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic buttons 1

Status
Not open for further replies.

Flashoid

Technical User
Dec 11, 2002
163
US
This is what I am trying to do:

Have forward and backward buttons that access swfs by using a current swf + 1. So basically it says I need to identify what swf I am currently accessing (say s_01.swf) and when the forward button is click go to s_01 + 1 or s_02.swf. Is there a way to code it so it can do this?

I am attempting to code a bunch of screens so I do not have to go into each screen and change the buttons in event pages change order, etc...



excuse my hack coding below but this is essentially what I want it to do.

on (release) {

current.swf +1
}


thanks!!
 
Is the current .swf's name held in some variable?

You can always do this kind of manipulation...

next++; // Number variable
current_swf = "s_0"+next;
container.loadMovie(current_swf);

Maybe better to provide your .fla, if the above doesn't clear up the issue...

Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Would I have this as my button code?

on (press) {
next++; // Number variable
current_swf = "s_0"+next;
container.loadMovie(current_swf);
}


I don't have the current swf's name held in any variables - it would just be a series of swfs labeled s_01.swf, s_02.swf and so on.
 
Well you can certainly try it... But as I posted, would need to see your setup, to be sure...

I did omit something in my code... +".swf"

Thus, it would be...

on (release) {
next++; // Number variable
current_swf = "s_0"+next+".swf";
container.loadMovie(current_swf);
}



Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Just for testing I tried creating a new flash file called s_01.swf. In that file I created an empty MC labeled container. I put in a forward button and put in this code:

on (release) {
next++; // Number variable
current_swf = "s_0"+next+".swf";
container.loadMovie(current_swf);
}

I created a second swf called s_01.swf. I tried putting the code above inside the container MC and in frame 1 outside of the MC but neither worked. It gave me this error: "Error opening URL
 
I don't know if this helps but with the "Error opening URL" error it shows this at the end of path:


s_0NaN.swf


Doesn't the NaN mean it's not recongizing it as a number??
I thought this might be a clue as to why it isn't working..
 
It may not be the only reason, but NaN is surely one of them...

Make sure the next variable is casted as a Number on the first frame of your movie...

var next:number = 0;

And maybe refer to it with _level0, since it would be a main timeline variable...

var next:number = 0;

on (release) {
_level0.next++; // Number variable
current_swf = "s_0"+next+".swf";
container.loadMovie(current_swf);
}

If it still doesn't work, you'll have to provide your .fla or a mockup one replicating the problem...

Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
here's a link to download the 2 fla's:




I basically just want it to dynamically load the next swf file in sequential order (based on the swf file name. so when you click on the forward arrow when you have s_01.swf open it loads s_02.swf, and when you have s_02.swf loaded and you click the forward arrow it loads s_03.swf, and so on)


thanks!

 
 http://www.4shared.com/dir/13204256/280eb9d0/sharing.html
oldnewbie -- do you know of any easy way to add bookmarking functionality to this? I tried using Shared objects with no success.

I was hoping to add bookmarking -- so let's say the user was on screen s_08.swf and then closed the page - I was hoping that when the user reentered it would take them back to the screen they left off on, in this case s_08.swf.

 
The only way to go is most likely through a sharedObject... But this would be more easily said than done.
If I recall correctly, you're loading movies so it's not as easy as directed them to the last frame there on... You also have to load that movie...

Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top