View Full Version : [FMX] - onEnterFrame alternative
a-v0id
September 8th, 2003, 03:43 PM
(quick intro about myself) I am fairly new to ActionScript but i'd like to say i am fairly competent in php, that having been said i want to apologise for this lame request for help, I have been trying to work with the tutorial that Freddythunder posted, I must be stupid clearly but the set example he supplies doesn't work once you compile/publish it, it doesn't work.
i've been debugging the php and from my vague knowledge of flash and actionscript i added a dynamic text box to return the var that i need to handle an if instance..... so the problem doesn't lie in there. if you aren't aware of the tutorial you can find it here (http://www.kirupa.com/developer/actionscript/authentication.htm).
i have come to the conclusion that the problem lays here in the ActionScript set on the first frame of the movie.
this.onEnterFrame = function() {
if(_root.checklog == 1){
_root.gotoAndStop(2);
}
if(_root.checklog == 2){
_root.gotoAndStop(3);
}
}
now i dont really understand what the "onEnterFrame" does and maybe that isn't the right command to be using .. i also noticed a stop(); at the very beginning of the frame... obviously this tells flash not to proceed with the movie.. but would it not also stop the rest of the commands being read after it?... I would really like to hear back with any ideas any one has.... i do apologise for my ineptity.
lac
September 8th, 2003, 03:55 PM
Hi,
onEnterFrame is run every time that the frame you have the code on is entered. I think MX defaults to 12 frames per second so the code in the function is run 12 times every second.
The stop at the top just keeps the movie on that frame but doesn't stop any of the other code on the frame from being used.
I haven't looked at the tutorial in question and haven't done any PHP stuff so I probably can't help with the rest of your problem but I'll take a look.
Liz
lac
September 8th, 2003, 04:03 PM
Sorry,
I'm at work and don't have mySQL or anything here.
Liz
a-v0id
September 8th, 2003, 04:05 PM
thank you lac... thats a start.... it gives me more of an understanding .. which is great!..
the php file returns 1 of 2 options depending on if the username and password is accepted
basically there is a dynamic text box named status ... which shows the logging on process
and in the php file you get a line returned like this
status=Logged in!&checklog=1
i tried altering the way it returned the date e.g.
_root.status=Logged in!&_root.checklog=1
but still nothing.... the checklog value is returned but isnt parsed by the function triggered by the onEnterFrame ....
would, and does it matter whether everything is on the same layer?... i initially had my text boxes images buttons all on independent layers so that it would be easier to edit... and applied the frame script on the bottom layer.. but then out of skepticism... i put everything on the same layer so that there wouldn't be any confusion
lac
September 8th, 2003, 04:26 PM
You shouldn't need the _root bit in the php file because the line in the flash stuff loadVariablesNum tells it to load into the root layer by having the 0 as the second parameter in the function call.
I would check for typos between the variable name in the php file and the flash code.
He also mentioned making sure that you didn't use capitals if you were using Unix.
How are you checking that the php is returning the value?
Hope some of this helped :)
Liz
a-v0id
September 8th, 2003, 04:35 PM
i am about to check the flash inside out again....
but what is really starting to annoy me is the flash caching i have to find a way to disable the caching... everytime i make an alteration and publish it i have to clear my temporary internet files.. which is driving me crackers,
i was wondering if in actionscript == is the same as in php... or does it have a new meaning?.... .. i made a mini alteration to the function which gave a result ... although not too positively
this.onEnterFrame = function() {
if(_root.checklog = 1){
_root.gotoAndStop(2);
}
if(_root.checklog = 2){
_root.gotoAndStop(3);
}
}
which send you straight to frame 3
so i am going to throw this in next.. once i found a way to stop flash from caching
if(_root.checklog = 0){
_root.gotoAndStop(1);
}
i don't think this will do anything... i bet you can tell me that already though.
oh well... i am pretty sure that all the variables are the same case.... and named correctly... .... i wonder if the _root.gotoAndStop(?) is correct... is that right?...
thank you for all your help Liz
lostinbeta
September 8th, 2003, 04:41 PM
Try changing status=Logged in!&checklog=1 to status=Logged in! and then changing if(_root.checklog = 1){
_root.gotoAndStop(2);
}
if(_root.checklog = 2){
_root.gotoAndStop(3);
} to if(status == "Logged in!"){
_root.gotoAndStop(2);
} else {
_root.gotoAndStop(3);
}
I didn't test it or anything, but it's worth a try :P (server-side flash is not my specialty :-\ )
lac
September 8th, 2003, 04:41 PM
Well I can clear up == versus =.
== is equality test = is assignment so you can't use if blah = fred then kind of construct cause it will make blah equal fred to start with.
For your browser (if it's IE or Netscape) go into the options/preferences and set it so it doesn't cache at all. I think it's under the advanced bit.
The gotoAndStop() function sends the movie clip to the frame number and then stops it from going any further.
So if you were to use gotoAndPlay(2) you would end up on frame 3 which is not what Freddy intended.
Did you use the fla and php files that he had available at the bottom of his tutorial or just what you made?
It might be worth it to download what he has and see if it behaves differently from your version and then compare the two if it does.
Liz
lostinbeta
September 8th, 2003, 04:43 PM
Senocular wrote an amazing anti-cache script for dynamically loaded content....
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=14268&perpage=15&pagenumber=2
It is the last post on that page.
a-v0id
September 8th, 2003, 04:55 PM
Originally posted by lac
Did you use the fla and php files that he had available at the bottom of his tutorial or just what you made?
It might be worth it to download what he has and see if it behaves differently from your version and then compare the two if it does.
Yes i did and it doesn't work... i decided to make my own and make it work, it is a relatively simple bit fun i just don't understand why it is causing so much grief.
oh and as for lostinbeta... i am working on it!!.. (it actually seems a very logical thing to do)
brb
a-v0id
September 8th, 2003, 05:44 PM
in short this hasn't worked at all... i'll start tomorrow morning first thing with a brand new FLA... as i can't even get it to do what it was doing before...
thank you all for your help!
lostinbeta
September 8th, 2003, 05:52 PM
a-v0id, you should try using/looking into loadVars() instead of loadVariables or loadVariablesNum. It's more coding, but it is a lot more versatile and easier to manipulate variables called in from an external file.
Freddythunder
September 8th, 2003, 07:04 PM
a-v0id - I didn't see this thread before and just sent you a three page email in responce to yours...:P
I don't understand why the files from the tutorial aren't working for you - that's odd. Those are the exact files (sans the passwords) that are used in the example. We'll figure it out, though.
As for using LoadVars() instead - here's a post about that whole shi-bang:
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31032&highlight=LoadVars
I actually didn't understand how LoadVars worked when I wrote that tutorial, so I used the LoadVariables method shown in another tutorial here. Both work and ahmed has a zip file with the LoadVars method on it in that script.
Good luck, let me know if I can help further ;)
a-v0id
September 9th, 2003, 02:28 PM
this is the 4 rebuild i have done of the blessed FLA file... and i still really can't get it to work... it tells me it is logged in yet it doesn't move to the next frame.
nobody mentioned the layers did they... they don't affect the frame or do they?
ho hum... i'll give you the fla file and everythign else you may need to check it out...
i'd love you forever and ever if you help me get this monster working.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.