View Full Version : navigation question
mashnote
02-22-2002, 10:31 AM
Hi,
Is it possible to have a back button in Flash,without using any html.I saw the Robert Penner thing,but that's not what i want.
I've been told you could go like one frame back with a set_property ? and multiple frames with an array..but that's a bit over my head. What's that about...don't wanna sound ignorant here :)
cheers
What exacly do you want to do, do you want recreate the back tton of the browser in flash or go back in the timeline of your flash movie?
SFA
mashnote
02-22-2002, 11:48 AM
Let's say a user clicks on a button that makes a mc play. Then he clicks on another button that makes another mc play.
Then if you click on a back button (in flash,no browser stuff) the previous mc should play. Like going back in time.
The back button is on the main stage,and not dependeant on labels,but dependant on what the user did before,randomly,without labels.
Hope this makes sense,it does to me,but that's not a guarantee :)
ther are many ways of doing this. Try assigning variable when tellin gthe movies to play. When you tell a movie to play assign a variable, lets say "currentmov" and create a variable "premov"and assign this before. I may have mixed you up . The code should look like this.
button 1
on(Press){
telltarget (movie1){
play();
}
_root.prevmov = _root.currentmov;
_root.currentmov = "movie1";
}
button 2
on(Press){
telltarget (movie2){
play();
}
_root.prevmov = _root.currentmov;
_root.currentmov = "movie2";
}
back button
on (press){
tellTarget(_root[_root.prevmov]){
play();
}
there might be a easier way of doing this but this is all i ccan think of at the moment.
im off to eat, good luck with that.
SFA
}
mashnote
02-22-2002, 12:29 PM
I just finished lunch so i'll try applying the code you gave me.
Results will be posted. And thank you very much :D
Greetz
just got back and realised, the way i posted will only work to go back once, do you intend having more movies and you want to be able to keep a record of all previous movies so you can go back all the way?
SFA
mashnote
02-22-2002, 01:27 PM
Yeah,i have more than 2 mc's,so it would be nice to use the back button for all of them and not just two :)
cheers
this is a bit more complicated. You need to create an array to record the order of the movies that were clicked. on the buttons try this.
on button 1
on(realease){
_root.movcount +=1;
_root.ordermov[_root.movcount] = "movie1";
telltarget(_root.movie1){
play();
}
}
now do the same on the other button changing the "movie1" to "movie2", "movie3" and so on.
on the back button
on(release){
_root.movcount-=1;
tellTarget(_root[_root.ordermov[_root.movcount]]){
play();
}
}
Also this way you can have a forward button.
Tell me if you need som eof the code explained.
SFA
mashnote
02-22-2002, 04:20 PM
I'll try that when i'm home or something(weekends..).I figured that it would have to do with arrays. Thanx a lot sfa !!
Someday,there will be an enormous party for y'all,'cause i'll never be able to return the favours in ActionScript :)
But i will persevere...
[Results will be posted]
mashnote
02-25-2002, 09:43 AM
Nope,can't seem to get it working.... You may explain the code a little bit if you want. The back button does something,but it does not go back the right way
can you attach a sample file
SFA
mashnote
02-25-2002, 11:35 AM
I remade the file so it's clearer (no graphics and stuff),but the priciple is the same.
instead of using arrays try using normal variables -
on the buttons
on(realease){
_root.movcount +=1;
_root["ordermov" + _root.movcount] = "movie1";
telltarget(_root.movie1){
play();
}
}
but the "movie1" in line three must match whicth the name of the movie in the tell target.
in the back button -
on(release){
_root.movcount-=1;
tellTarget(_root["ordermov" + _root.movcount]]){
play();
}
}
try this, it should work, if it doesnt post the file and ill arrange it.
the problem with the script before was that firstly you had not created the array - before filling an array you have to initialize it (arrayname = new Array;) and also in flash i realised that you cant edit the same array from different uttons.
SFA
mashnote
02-26-2002, 08:34 AM
i think i'm getting there,hang on :)
...no i'm not
mashnote
02-27-2002, 12:32 PM
Hey sfa,sory for the delay...
Here's the fla with your code in it (it's on the buttons in the client & cases menu).I tried to change the code and stuff,adapt it,but i put the original in it to make it clearer.
If anything looks not ok,or weird...just keep in mind that this is my first effort in making anything with flash :)
Anyway,hope you can figure it out
Cheers
M
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.