ActionScript 2.0 :: Detecting Even Or Odd Variables
Apr 26, 2006How can I detect if the variables are EVEN or ODD? The if statements will depend on that.
View 3 RepliesHow can I detect if the variables are EVEN or ODD? The if statements will depend on that.
View 3 RepliesI have an empty SWF that's sole purpose is to call loadMovieNum and start the project. Each loaded movie has a few variables defined within them - unique to those loaded SWFs. Instead of declaring all the variables in each SWF can I declare all of them in one place, in the first frame of the empty loader it all starts from? I'm thinking I can then declare a variable which each loaded movie can increment as needed for me.
View 2 RepliesHow do variables true/false custom variables work in flash?
For example, what I want to do is create a simple true=false variable that I can call on an if statement later.
For example:
Code:
Var1 = true;
if (!Var1)
{
[Code]....
I noticed that neither the "Var1 = true;" part or the if(!Var1) part worked in flash.
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 RepliesI have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don't seem to work the same way. I have tried moving the string array to give it full scope, and still nothing...
public class test extends Sprite
{
// Declare a list of strings
protected var title0:String = undefined;
[Code]....
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader();
var urlRequest:URLRequest=new URLRequest("receive.php");
urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
how do i detect the end of flv .. or when it finished playing?
View 7 Replieshow 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...
View 3 RepliesI 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?
There is a bird, and you control its upwards movement with a key. It has thrust, gravity, it works fine. The problem is I have a bunch of icicles that come at the bird that he is supposed to avoid. I tried this first with math random to use as an x coordinate and than move across the screen, but the icicles had the same x-coordinates sometimes. I tried does not equal(!=) but that doesn't work. I made an array and each number that came out of the array I assigned a different variable. This works fine. I put this variable into the x-coordinate such as mc.x=((n)*60)+480. I did this for five different icicles. All their differnt variables have a different value, and I put them into the same function for each individual video clip, but they still don't go to the right coordinate. Here is the test code just for the initial coordinate of each icicle before it moves...////////////////////////////Quote:
var temp:Array = new Array()
for (var i:int=0;i<8;i++) {
temp.push(i);
[code]......
i am trying to do a loop to create several variables to aasign each one of those variables one number.when i write
[Code]...
I have 2 loadVars - myVars, myPictures
basically i have defined their onLoad functions
so in myVars, i call for
Code:
myPictures.load("http://www.fakedevil.com/lurgee/pictures2.php?id="+this._parent.link2.text+"&time=" add getTimer(), "");
pictures2.php is working cos I just check so by rite the variables loaded should change.. but somehow each time I check those variables in myPictures.onLoad, the variables are always the same.
if I am playing a sound using start like this:
mySound.start();
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).
View 4 RepliesI'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.
View 3 Repliesis 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?
View 5 RepliesSo for a site I would like to have 2 swfs, mainContainer(just has preloader) and index(contains all assets)
This will allow me to have a nice, 0%-100% preloader.
However during development I will just be publishing index. So to start my chain of functions, I have my document class for index like this:
ActionScript Code:
public class index extends MovieClip
{
var path:MovieClip;
[Code].....
However, this will fail when index is loaded in to mainContainer, because the code gets run before I addChild on to the mainContainer displayObject.
So I need a way to detect whether index is loaded or not in another swf. How's that possible?? There doesnt seem to be an easy way.
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.
View 2 RepliesIm 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?
View 1 RepliesHow do i detect the IP address of the one that's visiting my web-site? Is there a way?
View 14 RepliesIs there a way of detecting a right-click through actionscript?
View 7 RepliesI 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.
View 2 Repliesis 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.
View 8 RepliesThe 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.
I thought I had a nice way to do this, but it's not always accurate for some reason. I was using (where myNumber is a number):
evenOrOdd = myNumber % 4; // 4 or any number
if (evenOrOdd == 0) {
// Number is even
}
I was working on some simple keyboard movement for an AS3 game, but running into trouble. Some keys would work, some won't!.I started a new flash just to test the keyboard, and confirmed what I was seeing. Some keys like "D" will work, while others like "A" don't seem to. Here is the code from the keyTest program.
Code:
package
{
import flash.display.*;[code]..
So when I press D or W, this flash outputs "68 down" or "87 up" or whatever as intended. But if I press keys like A or S, it outputs nothing. Wut?
I've been messing around with hittest and I can't figure out how to detect when the actual content of the MC collides with the other's, rather than just detecting when the bounding boxes collide.
View 3 RepliesI am tring to create a "find and destroy" game..I have 20 ball shaped movie clips..they move around randomly..I want to click(destroy) only the ones having certain names (enemy1,enemy2...enemy8)or having certain color....how can I write a function so that I can explode them clicking with my mouse .
onClipEvent(enterFrame)//on(Press)
{
if(this==enemy1)
[code]....