Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [Flash] can you tell me why my IF, ElseIF don't work? (https://thetfp.com/tfp/tilted-technology/113497-flash-can-you-tell-me-why-my-if-elseif-dont-work.html)

MexicanOnABike 02-16-2007 01:16 PM

[Flash] a few questions that i cannot find in the help.
 
I got this code
Code:

if (songmax.text == uvr_max.text)
        {
        songmax.text = 1;
        }
else if (songmax.text !== uvr_max.text )
        {
        songmax.text = Number(songmax.text) + 1;
        }
}

basicly, everytime someone pushes the button, it should add 1 to the dynamic text until it's equal to the other dynamic text and when it's equal, it should return to 1. now why is my if and else if not working? this way, it gets to being equal and then it just keeps counting up. like the IF was never there. i can give more info if you don't get it.

==================================
added questions:
using:
Code:

loadMovie();
I'm importing a swf in my movie and i need to be able to control it.
let's say this swf has 10frames, and with 1 button i need to stop when i want. how would i do this?!

i also need to find the file when it's loaded:
I have to find out how many frames there are. is that possible?
basically i need to know how to control a loaded movie in every way possible.
and if you don't know, can you tell me what would i do to find this in the help?

Halx 02-16-2007 01:21 PM

Correct me if I'm wrong, but isn't the correct syntax for "not equal" != or <>

At first glance, it just appears you have an extra = in your Else If

MexicanOnABike 02-16-2007 01:45 PM

well macromedia doesn't like the <> anymore but it does the same as !=.
and this is what the help says on these 2.

<> inequality operator
!= inequality operator
!== strict inequality operator

with 2=, and 1= it does the same. I don't get it.

-------------
more info if it helps:
songmax is a Dynamic text that starts at 2.
uvr_max is a dynamic text that starts from a loaded text file so it's random which is why it needs to check songmax with uvr_max. right now, it's set to 5.
before i click:
songmax=2
so when i click the button:
songmax=3
again:
songmax=4
again:
songmax=5
At this point, the next click should recognize it's at 5 and go back to 1. but it keeps going.

Jinn 02-16-2007 02:19 PM

You gotta let me see this flash app after you're done.. after that last post. :)

That said, why do you need an if / else if? I know they recommend checking all your conditions so you don't accidentally fall into an else, but why even check the condition?

The else implies that they're not equal simply by the fact that it didn't go into the if;

If they're equal, do this.
Else (it's implied they're not equal)

Also, have you tracing your uvr_max ? I know you're watching songmax, but are you sure uvr_max is being set correctly from the file?

MexicanOnABike 02-16-2007 08:33 PM

well i tried with an else but that wasnt working so i tried a "else if" but it's still not working. I know it's working because they're dynamic text fields that are there visible. i'll try tracing them which i shoulda done in the 1st place...
and yes, i will post what I'm making once it works! haha

off to try more things!

.:::EDIT:::.
ok, i'm an idiot. I was loading from a text file right? well i thought the text file would work like a normal flash script so i added some comments // after my uvr_max variable so when i tried doing your trace idea, it gave me:
Code:

3

//

i'll go and make it work now. the equal should work! thanks for making me realize my stupidity! haha.

MexicanOnABike 02-19-2007 11:19 AM

added questions:
using:
Code:

loadMovie();
I'm importing a swf in my movie and I need to be able to control it.
let's say this swf has 10frames, and with 1 button i need to stop when I want. how would I do this?!

I also need to find the file when it's loaded:
I have to find out how many frames there are. is that possible?
basically i need to know how to control a loaded movie in every way possible.
and if you don't know, can you tell me what would i do to find this in the help?

Jinn 02-22-2007 12:32 PM

Sorry I took so long to reply.

No, not to the best of my knowledge, not easily. Extracting the number of frames in a SWF requires reading the file header itself, which there is no standard library for, as far as I can see.

MexicanOnABike 02-22-2007 02:49 PM

Quote:

Originally Posted by JinnKai
Sorry I took so long to reply.

No, not to the best of my knowledge, not easily. Extracting the number of frames in a SWF requires reading the file header itself, which there is no standard library for, as far as I can see.

it's cool. i was on flashkit's forum looking for an answer but most ppl don't get what i mean 99% of the time...

knowing the frame # isn't a big deal anymore. now i just need to PAUSE the movie. is that even possible? someone mentionned levels but I have no ideas how to work with them . and flash isn't any help. typing LEVEL in the help brings nothing at all.

edit: oh someone replied to me. http://board.flashkit.com/board/show...98#post3815598

now the impossible task to figure out how to know when the movie is done playing.


All times are GMT -8. The time now is 12:53 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62