This is a discussion on "Midframe variable" within the Flash & Multimedia Forum section. This forum, and the thread "Midframe variable are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Midframe variable
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Midframe variable
I borrowed some code to create menu transition swfs in which as a button is pushed, it will look to see if the current swf is at midframe and if so, play the exiting animation of that swf and then load and play the intor for the swf for that button selection (hope that makes sense).
However, I have enhanced my swf files to have a number of stop actions for submenu items for that catagory so the swf does not automatically just play to the midframe and stop. Is there a way that I can modify the code so that if the swf is not at midframe yet, I can have it "gotoandplay" midframe if that makes sense? Here's the code: on (release) { if (_root.currMovie == undefined) { _root.currMovie = "OrangeAll"; container.loadMovie("OrangeAll.swf"); } else if (_root.currMovie != "OrangeAll") { if (container._currentframe >= container.midframe) { _root.currMovie = "OrangeAll"; container.play(); } } } Thanks, Dave |
|
|
|
|||
|
Re: Midframe variable
You could create a variable called currentFrame, and create a another if then statement around that.
var currentFrame:String(); Then at the beginning of your project make sure the variable is set to nothing, or some value. Then when it does the release of the button, have it check the currentFrame variable and if it is not equal to "midframe"(or maybe undefined) then have it advance to that spot on the timeline with a goto command. Also, at the "midframe" marker in the timeline (make sure to name the frame as a marker)v- make sure to have it set the variable currentFrame = to "midframe" so it changes. Then it's just a if/then statement sort of like you've already created to check to see the value of the variable, and either go to the midpoint, or just play if it is already at the mid-point. Make sense?
Last Blog Entry: Yay!? (Oct 8th, 2007)
|
|
|||
|
Re: Midframe variable
Hey, thanks for the advice. I'll give it a try and let you know!!
Dave |
|
|||
|
Re: Midframe variable
Well here's what I tried to do. What I attempted was to modify my existing code slightly by adding another if statement:
on (release) { if (_root.currMovie == undefined) { _root.currMovie = "OrangeAll"; container.loadMovie("OrangeAll.swf"); } else if (_root.currMovie != "OrangeAll") { if (container._currentframe >= container.midframe) { _root.currMovie = "OrangeAll"; container.play(); { if (container._currentframe < container.midframe) gotoAndPlay(midframe); } } } } What I was hoping is that my last if statement is telling it that if the current played frame is less than midframe, goto and play midframe. But it doesn't seem to work. Any ideas? Dave |
|
|||
|
Re: Midframe variable
Well I tweeked it some more, but still no results...
on (release) { if (_root.currMovie == undefined) { _root.currMovie = "OrangeAll"; container.loadMovie("OrangeAll.swf"); } else if (_root.currMovie != "OrangeAll") { if (container._currentframe >= container.midframe) { _root.currMovie = "OrangeAll"; container.play(); } else if (container._currentframe < container.midframe) { gotoAndPlay(midframe); } } } |
|
|||
|
Re: Midframe variable
Well I'm trying but still no luck...
on (release) { if (_root.currMovie == undefined) { _root.currMovie = "OrangeAll"; container.loadMovie("OrangeAll.swf"); } else if (_root.currMovie != "OrangeAll") { if (container._currentframe >= container.midframe) { _root.currMovie = "OrangeAll"; container.play(); } else if (container._currentframe < container.midframe) { container.gotoAndPlay(midframe); } } } |
![]() |
| Tags |
| swf transitions |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| variable classes | CloudedVision | PHP Forum | 4 | Feb 14th, 2008 03:07 |
| Goto - midframe button problems | Toby1979 | Flash & Multimedia Forum | 25 | Sep 11th, 2007 21:21 |
| is this variable right? | geyids | PHP Forum | 4 | Aug 6th, 2007 21:45 |
| Passing a Variable to ASP | Smog36 | Flash & Multimedia Forum | 1 | Sep 13th, 2006 14:05 |
| variable problems... | tehrobot | Flash & Multimedia Forum | 4 | Sep 13th, 2006 13:01 |