ActionScript 3.0 :: Checking All Iterations In A For Loop?

Jul 5, 2010

I'm trying to write a script to make iterations of a imported class file through a for loop. Currently, my menu buttons work for revealing themselves when clicked, but I want to make it so that if I click another button, the previous button collapses (or generally, all buttons except for the one that's clicked get collapsed).Here's the section of code:

ActionScript Code:
var ColorArray_arr:Array = new Array(DarkBlue,MidBlue,LightBlue,Gray,OffWhite,Goldenrod);
var ButtonLabels_arr:Array = new Array("menu one","menu two","menu three","menu four");
var ButtonArray_arr:Array = new Array();

[code]....

Is there something I can add to my event handler to make it so that anything that's not the target equals true? If so, would I have to put it in the for loop as well?

View 3 Replies


Similar Posts:


MX04 Understanding 'for' Loop Iterations

Mar 25, 2009

How come every time I run this script:[code]Where does the Undefined come into things? I have only asked the script to fire 3 times so the first time through the text in position [0] in the script Carp should be printed out?

View 2 Replies

ActionScript 2.0 :: Checking Current _x Position With A Loop?

Apr 3, 2009

I have this tween function that moves an object 100 pixels as soon as it enters the frame.

if (currentValue % 15 == 1) {
var rab1:MovieClip = rabbit1._x;
var myHoriTween:Tween = new Tween (rabbit1,"_x",Regular.easeInOut,rab1,(rabbit1._x = rabbit1._x + 100),2,true);
myHoriTween.onMotionFinished = function (){
this.stop()
}

My idea is to set up a loop to watch the tween, once it advances its 100 pixels from where it started I want to do a few things before I go to the next frame. Right now I'm using a timer, but it limits my ability to control the playhead.

I've been trying to create a loop to check the current _x and trace it so I can see it advancing as its tweening but it's simply too advanced for me.

View 1 Replies

ActionScript 3.0 :: Checking When The Sound Inside A Loop Is Completed?

Jul 24, 2009

When I play a sound on a loop using the sound.play(0,loops) method, the channel doesn't dispatch an event when the sound is completed each time inside the loop - but, only after all the loops are played. Is there a way to check out when each loop is done?

I know there's the way to play only once, and check when the channel dispatched SOUND_COMPLETE and then play the sound again - but this method actually doesn't work as intended, as it creates a really small interval between each loop, which is noticeable and destroys the whole looping effect.

View 2 Replies

ActionScript 2.0 :: Slider To Control Multiple Swf's With Loop Checking?

May 18, 2010

I have to create a slideshow that loads 16 different swf's into a container_mc. Each swf has an image with accompanying voiceover.

I have the basic next, previous, first, and last slide buttons working but they want to add a slider bar that plays and u can slide to a specific section of the slide show. The slidebar is where I am having troubles.

Here is what I have so far...

This is the code on the first frame for the buttons

Code:
nowPlaying = 1;
lastPlayed = 0;
playingNext = 2;
autoPlaySlides = false;

[Code]....

For the slider I need to create some kind of loop that checks where the dragger is. If it is between 1 and 6 slideLabel = "Go to slide 1"; If it is between 7 and 12 slideLabel = "Go to slide 2"; and so on up to 16... when the dragger is released on the slide the user wants to go to it needs to load specified .swf.

View 1 Replies

ActionScript 2.0 :: Slider To Control Multiple Swf's With Loop Checking

May 18, 2010

I have to create a slideshow that loads 16 different swf's into a container_mc.
Each swf has an image with accompanying voiceover.

I have the basic next, previous, first, and last slide buttons working but they want to add a slider bar that plays and u can slide to a specific section of the slide show... The slidebar is where I am having troubles.

It is partially working now, just needs to be tweeked... It is reading the variables, and setting the slide label text to the correct label, BUT it is only doing this once when the mouse is pressed and does NOT update when the mouse is dragged. I tried so many different ways and can't figure this out.

Here is what I have so far...

This is the code on the first frame for the buttons

Code:
nowPlaying = 1;
lastPlayed = 0;
playingNext = 2;

[Code].....

For the slider I need to create some kind of loop that checks where the dragger is.
If it is between 1 and 6 slideLabel = "Go to slide 1"; If it is between 7 and 12 slideLabel = "Go to slide 2"; and so on up to 16... when the dragger is released on the slide the user wants to go to it needs to load specified .swf.

View 2 Replies

ActionScript 2.0 :: Loop Through Array Checking Every Item Equals True?

Oct 27, 2009

I have an array. I have a button, when I press on it I want to be able to loop through every item in the array and see if EVERY item is equal to true, if so I want something to happen.

var allIsTrue = false;
_global.myArray = [false, true, false, true, false, true, false, false, false, false, false, false, false,false,false,true]
///would not do something

[Code].....

I thought I could loop through each one and if a false statement if found, the loop stops and the variable allIsTrue = false. But if the loop cycles all the way through allIsTrue = true.

View 3 Replies

ActionScript 3.0 :: Flash Optimizing Code For High Number Of Iterations

Jun 4, 2010

I'm posting regarding a small app I'm working on that basically allows a grid of particles to be manipulated based on the mouse position. It is fairly primitive in its ideas, but I thought it would be a good test of my newly acquired actionscripting knowledge! It runs on the basic idea that (when clicked) a force is applied to a particle (movieclip instance). The force is inversely proportional to it's distance.

A loop goes through all the particles in the grid (a 1 dimensional array) and calculates this force, changes the velocity, and then the position. This happens every frame for every particle. At about 10,000 particles however I notice a huge decrease in fps. I know what you're thinking, its because of the amount of particles! However, I thought that the performance of the app would be directly affected by the processing power. Considering my itouch can easily handle about 8000 particles I'm guessing my pc should be able to handle 10000 particles a lot better.

View 14 Replies

IDE :: Checking If MC Exists?

May 26, 2009

I have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.

I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.

[AS]
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);

[code]....

When I test, it comes back with the trace "doesent exist", even though it does exist.

View 5 Replies

ActionScript 3.0 :: Create A Loop So Icons In Menu Continually Loop Indefinitely

Apr 16, 2010

I would like to create a loop so the icons in the menu continually loop indefinitly.[code]

View 2 Replies

CS3 - Key Checking Function Not Working?

Sep 8, 2009

I must admit I have struggled with this thing for a bit. It seems simple but for whatever reason I can't get it to work. I just want to make something move in AS 3 right now, and so far I've tried puzzling together two different tutorials, but both of them are missing either some source files or further explanation.

Anyway, here is the code (The bit I am having problems with)

Code:
//event listener checks for key presses
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkkey);
//Create keyHandler function

[Code].....

The problem is the checkkey function in the update function. If I leave the parenthesis empty it tells me it needs an argument, if I leave it like that it tells me I need a right paren before colon.

View 2 Replies

Checking Collision Between Two Symbols

Jan 7, 2010

What kind of code would one need to check for collisions between two symbols? I am hoping to become a game designer so this is important for future references.

View 8 Replies

ActionScript 3.0 :: Checking If MC Exists?

Feb 15, 2010

I have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.

code:
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);

[code]....

this is my code. When I test, it comes back with the trace "doesent exist", even though it does exist.

View 5 Replies

Checking Variables With If (varibale = *)

Oct 20, 2010

why this code works on my other flash file and it doesnt on the new one. This is the code:

if (test == "PRIZE1"){
trace ("prizes/prize1.jpg");
}

[Code].....

Basically it should check whther the variable has any of the above words loaded on it dynamically so that it loads a movie that corresponds to it. I put the trace on the above so I can track whther it was reading or not. Obviously it wasnt. My publish settings are Flash Player 8 with Actionscript 2.0

View 4 Replies

Variable Checking Isn't Working?

Jul 14, 2009

Google is ranking my site preety high BUT (bigBut) in MOST searches it lists my swf-s not html pages. So when clicked they are shown in a browser window as single swf-s, not as part of html page. I am trying to workaround this by means of some variable to inspect if swf is opened as standalone or within a html.Here is the problem. I've set up a swf (swf_01 for example) in html page that loads another swf (swf_02) which is in swf_s directory. Swf_01 establishes a variable _global.isActive = 1; when html loads swf_01. So if swf_02 is loaded into the swf_01 variable is TRUE and that is OK and if the swf_02 is loaded directly from search results as a standalone swf it's not OK. That works so far. In swf_02 there is a code that checkes if variable is undefined (meaning that swf is loaded directly from search results) and, if it is, loads the right html into "_self".Somehow it's not working. Maybe my code isn't right.

Code in swf_02 (loaded one):
/if(isActive==undefined){ loadMovie("http://www.mydomain.com/index_services.htm", "_self");} // meaning: if variable is not true > this swf is loaded into browser directly from search

[code]....

View 7 Replies

ActionScript 3.0 :: Checking If A Swf Is Already Loaded?

Aug 28, 2009

I want to know how to check whether a SWF is loaded or not.

View 10 Replies

ActionScript 3.0 :: How To Checking A Textfield

Nov 22, 2011

I'm sure there is a very easy solution to my problem, but I haven't found it yet. My first frame consists of one input textfield, and two buttons. This textfield is sort of like entering a code to jump to another frame. "no" is a button if you don't have a code, and "go" is if you want to submit a code. Here is my Actionscript:

import flash.events.MouseEvent;
no.addEventListener(MouseEvent.CLICK, continueF);function continueF(e:MouseEvent):void{ nextFrame();

[code].....

View 7 Replies

ActionScript 2.0 :: Checking To See If A Variable Contains Anything

Aug 25, 2009

I need to know if it's possible to check to see if a variable contains any information or if it's just blank basically I have a text file on the server that may or may not have a url in it, I have my flash file programmed to grab the url from that text file and apply it to a button that when clicked brings up that URL...but that text file may not always have a URL in it, so for those times i want the button to not be clickable, or at least not attempt to go to a URL.

[Code]....

View 1 Replies

ActionScript 3.0 :: Checking If A Swf Is Already Loaded Or Not?

Aug 28, 2009

how to check whether a SWF is loaded or not.

View 3 Replies

ActionScript 3.0 :: Checking For Variables?

Feb 5, 2010

Each button has 3 different animations on the same timeline: one for when you mouseover, one for when you mouseout, and one for when you click. Each animation ends with a 'stop();" command, obviously. However, when someone mouses over, then out of a button quickly, it interrupts the "over" animation and begins the "out" one, which looks choppy and awful. I need a way that when I mouseover a movie clip, a variable within said clip changes to 0, and when I mouseout, it changes to 1.

The big problem comes with the fact that I have multiple buttons with listeners, all of which use the same generic function to respond to mouseover/mouseout events. Is there a way to set up a variable associated with each button, then call the specific variable within the generic function?

ActionScript Code:
button1.outcheck = 0;
button2.outcheck = 0;
button3.outcheck = 0;

[code]....

Is there a viable solution, or will I have to just rethink the entire animation?

View 3 Replies

ActionScript 2.0 :: Checking If Two Mc's Have Been RollOvered?

Sep 4, 2006

I have two movieclips. I would like to check if both movieclips have been rollOvered and then do an action. You can't rollOver them at the same time. So, I need something like: if movieclip 1 has been rollOvered and movieclip 2 has been rollOvered (no matter what following order) , then do action.I tried this using booleans and an if statement but no luck.

View 1 Replies

ActionScript 2.0 :: Checking If Key A - Z Pressed?

Apr 15, 2007

I am trying to figure out how to check when the key "A - Z" is pressed...How can I use ASCII characters to check this?, or even if I check something like this
if(Key.isDown(Key("A")))

How to check when keys A-Z are pressed, preferably something like this
onKeyPress("A") = function() {
"run code"
}
Anyway to do this? Basically hotkeys, press "s" to call a line of function that will save the game.. etc...

View 3 Replies

ActionScript 2.0 :: Checking For New SWF's On A Server?

Jun 25, 2007

i made my site with levels so there are lots of swf's being updated, and i cant seem to get some of them to work. i think that my problem is that the swf's are being stored on the cache so when i update them, it doesnt reconize that its a new swf

is there a way to put in code to when someone goes to my site, to check their cache to see if there are any newer versions of the swf they have on my server?

and if it is possible, MAYBE making it so i dont have to put it on EVERY button (but if thats the only way fine i will live)

View 4 Replies

IDE :: Checking An Input String?

May 15, 2009

I do math applications for the web. Often I have to check if a user input is correct. For example: the right answer is 3x+5. Is the user input that.I do this by checking character by character. I don't think that it is the best way, especially since the user may have written 5+3x, which is right, too, although it is preferred to write the other way around.I sometimes have to check more complicated expressions, like -3x^2+7x-15 or -2 sin (4x^2).Right now I'm doing an equation solving exercise. There I have to check what the user wants to do to the equation, like +2x or /(-5).

View 2 Replies

ActionScript 3.0 :: Use A Loop To Create Text Field With The Loop's Current Value

Dec 11, 2010

I am attempting to use a loop to create text field with the loop's current value. The code looks like this:

ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}

So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".

View 7 Replies

ActionScript 2.0 :: Infinate Loop For M.clip.the Looping Part Does Not Want To Loop?

Jun 13, 2004

i'm trying to do an infinate loop for my m.clip.the looping part does not want to loop...it loops back to my firrst frame even though there are two same picture in the movie clip.....here's a sample of what i use for the infinate loop script..

[Code]...

View 2 Replies

ActionScript 3.0 :: Checking If A Child Exists?

Feb 8, 2009

My page has 2 tab menus. When the page first loads, it defaults to the first tab, but when the second tab is hit, an image is loaded to the stage. I want to remove the image from the stage once the first tab is hit again.I keep getting the error "Access of undefined property Image1" but the whole point is to check if this child exists with the if statement.

//Tab 1
if (Image1 != undefined) {
stage.removeChild(Image1);

[code]....

View 3 Replies

ActionScript 2.0 :: Checking For External File?

Apr 10, 2009

I want to use an external actionscript file for a set of variables for a movie I'm working on.

However, as I cannot guarantee that the external file would be available (it's for our sales reps to use on their own laptops) is there a way of testing for the #included file?

My idea is that the integrated script looks for the external file: if it finds that file, it is used. If the external file is unavailable, the internal script defaults to its own variables.

View 3 Replies

ActionScript 3.0 :: Error Checking For AddEventListener?

Apr 21, 2009

The problem I've found that I keep having and that is pretty recurring between a few of my classes is that several classes use addEventListeners for complete events on loaders, tweens, etc. The question I have is, how do I catch those events in the event that the instantiated class object is removed from the swf file? Because the eventListener keeps listening, for some reason(I assume the object is removed from the stage but garbage collector doesn't get it right away).

My current, most prominent example is this:I have a photo album that utilizes php to import filepaths on the server. There are basically 2 stages: one screen where all the albums are displayed, and another screen where all the images for a given selected album are displayed.

The problem is that when you click one of the albums, it loads all the images from that album and THEN transitions to the viewing page. This is good because it doesn't load all the images from all the albums.
The problem is, it's possible for the user to click one album, and really quickly, before the "album" page fades out, click another album.

If I've managed to not twist your brain inside out with this poor explanation, you may see that the loader object for the previously clicked "album" button will still be loading the one of the previous images. So, when the complete event for the loader is fired, I get this:

Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.

Which I assume, obviously, is 2 separate error events. I'm already using error catching that's working for another purpose, but I just can't catch these ones no matter where I put my catch statements. Any help?
Here's the code:

Code:
function clickHandler(event:MouseEvent):void
{
//////some stuff here
////////preps album images for display

[code]....

The first type error gets caught. It loops back through and works fine when you only click one button at a time, but otherwise it freaks out. I just don't know where to put the catch statement so that it just shuts up...

View 17 Replies

ActionScript 3.0 :: Checking If Variable Is Provided?

Jun 28, 2009

Is there a good way to check if a variable has been passed into my flash movie?For example lets say I have an app that looks up some data based on location. And I allow for it to be added to the HTML tags, In Flash how to I say set a default location in case of there not being one in the HTML tags?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved