ActionScript 2.0 :: Unable To Detecting Var Output "NaN"?
Jul 8, 2004
I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.Code:valuetest = value*1;For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.
Code:
if (valuetest == "NaN") {
gotoAndPlay("error"); }
I have a class called BgItem that I want many other classes to extend. But I also want to be able to use instances the BgItem class itself. Within the BgItem class file, I want to be able to detect whether the specific instance is of the BgItem class or an extension of it. I know I can detect if a class is in an object's chain of inheritance using the "is" operator, but how do I detect if a class is at the end of the chain?
I've set up FlexUnit in my app, I want to debug a test using trace, but im not sure how to get flexunit to traceto the flashlog file. Here's part of my test task in ant, I thought the 'localtrusted' property would help, but it doesnt seem to. In my logs I get the testcases only, none of my traces which are inside my tests.
I have 2 movieclips. First its star and second its house. I use keyboard cursor to move my star. When star connect to house i want see "boom" on output. So, all working. But i see boom when star mc border connect to house mc border. But i want to know . Is it possible to make boom just when i connect star body mc, not border.
I need to be able to detect if the input a user types into an Input text field is not a number (NaN). I thought this would be a breeze, but I am having trouble. First I created a function that sets a new variable equal to the input value multiplied by 1.
Code: valuetest = value*1;
For testing purposes I placed a temp text box on the stage (var: valuetest). Sure enough, when the function is called and if value contains anything but numbers, valuetest becomes NaN. Then later on the timeline I check what valuetest is.
Code: if (valuetest == "NaN") { gotoAndPlay("error"); }
Does not do what it supposed to. I tried doing this several ways, including putting all the code into the function, but I can not get it to "see" the NaN as a variable. I replaced the "NaN" in the if statement with a number and it works when I input that number... so I suspect that the code is correct and the problem has to be something to do with how Flash deals with a NaN output.
I'm teaching myself ActionScript and the book I'm reading just got into input text capabilities. The book shows me how to link input text to a variable and output that text to the output window using trace. My question is: how can I display the text that the user input onto the actual movie. For example... if I wanted the visitor to type their name into the input text box and click Submit and then a phrase shows up with their name such as "Hold on Name, my site will be done soon." How do I reference that variable and have it actually display in my movie?
I work with Flash Pro allmost 11 hours per day and every while i get a error which messes up everything. Approximetly i get this after about 2-3 hours withevery project.After i get this error there is no chance to test movies afterwards.I see a fast flash of the loader window but it dissapears so fast i cant even really see if it is loader.
I have a site that plays either .mp3 or .flv files depending on what is selected from the menu. Menu loads in from xml. I get "unable to make connection with server or unable to find flv on server" when I try to play the video. But the video and audio files are all in the same directory and the mp3 files play fine. I think I'm having a problem with the setMedia command. Here's the code that loads the video and audio files.
how to detect the end of an flv playback. I am loading in a flv to a webpage, using the FlvPlayBack component. Everything is working fine as to be expected. How do I insert a credits image to display once the flv has finished? Users would need to be able to restart the flv playback too. I have been looking at cuePoints etc...
I have embedded a swf into a another swf using Loader & URLRequest methods, which work fine.
To detect whether the swf has ended I define it as a MovieClip. Then I check (using an ENTER_FRAME event listener) if the current frame is equal to the total frames. This works fine for a swf with a simple animation in the timeline (what I was testing on). However:
If I use the same method for a swf with a streaming flv inside it, it gives me a runtime error: Type Coercion failed: cannot convert Play_Intro@20d71b51 to flash.display.MovieClip.
If I define it as a Sprite- it plays without any errors, but then how do I detect when the swf is at the end?
is there a way to detect when the sound is done playing? i want to make something happen but only after the sound is done playing.if i know the length of the sound, can I just wait that many number of seconds, or will it not synch up on slower/faster computers?
I am trying to implement paged recordsets in a datagrid and since I've not been able to find a way as a standard feature of as3 (recordset type was not provided in as3) - I'm cooking my own.The only problem I have is knowing when additional records should be requested. I need to be able to tell when the scroll bar or other method is used to scroll the datagrid down to the end (or near the end).
I'm trying to make this fluid preloader that uses tween classes to change the size of the bar instead of just using something likegotoAndStop(percent)I have the tween class working but need a way for it to detect the change of the percentage variable. Here's what I'm trying to get it to do:Current percentage is at 55, this is set as the "currentPercent" variable. It suddenly jumps to 65%, the "currentPercent" variable would change to 65 while the "prevPercent" variable would stay at 55 so the tween class could have a beginning and ending value.
is it possible to detect if flash is installed using PHP. My aim is, that if it is installed it will play a flv file, and if not it will use another player eg; quicktime?
Basically it's a browser window scaleable flash movie, that most of it's elements move position to each RESIZE event. But a part of it is pretty cpu heavy, so I want that to only update when the user have stopped resizing.
I have not found anything about this in the forums and the solutions I've tried are not working.
- tried MOUSEUP event on stage, but the mouse is off the stage, so it doesn't register.
- tried a timer that measures the stop of movement of the mouse, but mousX/Y is not measured when mouse is off the stage.
UPDATE: mouseX/Y might not work, but stage.stageWidth is updated. But still not a very nice solution
Im having a problem with some rollover code im using for a movieClip, basically if the mouse runs over to fast the rollover animation is played but not the rollout as the mouse has left the SWF area. Is there anyway of telling where the mouse is on the screen so i can run a check to see if its in the swf or not and then run code accordingly.
Im creating a flash projector that opens some other projectors with the fscommand exec command. Is there a way of detecting when the mouse is over one or another to change some values of variables?
I have an mc that moves into position after a button is pressed. I would like a seperate mc start playing after the moving mc stops.how this can be achieved? I have attached a sample .fla file that has the parts that are needed.The file was over the allowed limit so I have uploaded it here:I would like the mc 'red' start playing after the mc 'longBar' stops moving. The mc 'longBar' starts moving after the gray square button is pressed.
is there anyway way possible to apply actions to a button something like this...on(right click);Gotoandstop(1)so that when you rightclick the button, it will go somewhere? Ive been looking with no avail.
The thing is, when the application is lunched, I use a PHP file to create the thumbnails and save them on the server to save loading times the next time the application is loaded. That way, my company can run it before showing it to the client, and the client will have a shorter loading time on his end, since the thumbs will already be done.
Problem is, I also have to plan the eventuality that the application won't be run on a server, and so far, I haven't been able to detect this, or catch an error that would mean I'm not on a server.
I need to use the same flash menu for 2 different languajes. The swf menu are just buttons with photos but is there a small text that should reflect the current page languaje
IE:
index.htm should have menu.swf in english but index_spanish.htm should have menu.swf and show only the texts in spanish.
I though just using dynamic txt fields with a var name "lang" to set the text to "buttonname" or "nombredeboton" depending on what page the swf is located.
So what I need is a method to swf detect whether the page is english or spanish (perhaps based on browser url?) that way I could use just one swf file for both languages.