ActionScript 2.0 :: Loops And Identifying Instances?

Jun 1, 2004

I have 16 layers of movieclips (one in each layer), each has been given the instance name, "line1" through to "line 16". I'm trying to figure out how to hide all of them through actionscript, so far, my code is:

for(x=1; x<17; x++){
line[x]._visible = false;
}

but for some reason, it doesn't hide all the instances. I've tried typing it in seperatly, (line1._visible = false; , line2._visible = false; , etc...) and it works, but for some reason, when I use the for loop, it doesn't work...what am I doing wrong?

View 2 Replies


Similar Posts:


ActionScript 2.0 :: For Loops And Identifying Instances?

Jun 1, 2004

I have 16 layers of movieclips (one in each layer), each has been given the instance name, "line1" through to "line 16". I'm trying to figure out how to hide all of them through actionscript, so far, my code is:

for(x=1; x<17; x++){
line[x]._visible = false;
}

but for some reason, it doesn't hide all the instances. I've tried typing it in seperatly, (line1._visible = false; , line2._visible = false; , etc...) and it works, but for some reason, when I use the for loop, it doesn't work..

View 2 Replies

Using Movie Clip Instances In FOR Loops?

Dec 4, 2009

if there is a way to use movie clip instances with FOR loops (yeh I'm not skilled with OOP so I premade mc's instead using loadMovie :for example I made manual SwapDepth function between movieclips, I have hero1_mc, hero2_mc,...,hero6_mc and enemy1_mc,..., enemy12_mc. The code looks something like this:

Code:

if (_root.hero1_mc._y > _root.hero2_mc._y) {
tempDepth1 = _root.hero1_mc.getDepth();
tempDepth2 = _root.hero2_mc.getDepth();[code].....

...and so on, code works fine but if I were to write all compares manually it will be thousand lines of code to check each movie clip with each other.So I was wondering is there any way to put those movie clip instances hero1_mc, hero2_mc... into FOR loop like (code doesn't work, if there could be a way to replace numbers with variables):

Code:

for (i=1; i<18; i++) {
for (j=1; j<18; j++) {
if ("_root.hero"+i+"_mc" > "_root.hero"+j+"_mc") {
.......

so I don't have to type all combinations D: so far I haven't found any way to do so, is there any way to make something similar with FOR loop and movie clips? I'm working on my project with AS2.

View 1 Replies

ActionScript 3.0 :: Populate 2 Dictionary Instances In 2 For-loops?

Sep 30, 2010

I am trying to populate 2 dictionary instances in 2 for-loops. Then later I am trying to reference the objects that are stored in the dictionaries as the objects are dragged and dropped. I am having a problem with that part of it. I have put all of the dictionary code in red.

Code:
import flash.utils.Dictionary;
var loaded:XML = new XML();
var loader:URLLoader = new URLLoader();

[Code].....

View 1 Replies

ActionScript 3.0 :: Identifying Memory Leaks?

Feb 23, 2007

I have an AS3 application which seems to be leaking memory slowly while running. I've been looking for a profiler for Flex 2 / AS3 and haven't been able to find one yet, in fact I saw posts from people at Adobe saying they were working on it but no release in the short term!

Does anyone have any more news on this, or more usefully have any information on a profiler or other way it is possible to find memory allocation and usage during runtime of an AS3 application? It would really help me to identify what areas of my application are leaking memory.

View 4 Replies

ActionScript 3.0 :: Identifying The Nature Of Properties?

Oct 27, 2009

I am trying to produce an auto check on the synchronizing process between XML values (string based by nature) and object properties.

E.g. if the property on the instance is of

Code:
public var isThere:Boolean
public var anum:Number

the code should know the type and adjust the property value

Code:

isThere = Boolean(xmlValue)
anum = Number(xmlValue)

Its all swell apart from Arrays, which mainly are identified as 'object'.

Anyone know the best check to differ between Array and Object?

View 4 Replies

ActionScript 3.0 :: Identifying An Item From A Xml File?

Feb 28, 2012

I have an xml and it has items, you can trace the items in Flash, but how do I call them to allow me to identify that object getting clicked on the stage?

e.g. Item 1.2- how can I identify it in Flash?

<?xml version="1.0" encoding="UTF-8"?>
<menus>
<menu id="1">

[Code].....

View 2 Replies

ActionScript 3.0 :: Identifying MovieClip By Coordinates

Apr 11, 2012

I've been scouring the web to see how to do this, and now I'm not even sure it's possible. However, it seems there must be way. What I want to do is create a function that will take x,y coordinates and tell me what MovieClip or Sprite is at that location. I want it to happen automatically, without any MouseEvents or anything like that.

View 8 Replies

ActionScript 3.0 :: Identifying The Child In RemoveChild Action

Nov 23, 2009

I am creating a selection of checkboxes that are supplied from XML. These checkboxes are to provide additional details to a background picture and therefore they each have a unique name and an eventlistener to add the extra details to the background picture. Depending on other buttons clicked on the stage, the list of checkboxes could change for the same background picture. I have a selection of 5 different background pictures all of which have a different list of checkboxes. I therefore want to load the checkboxes dynamically. When a button is clicked to change the background picture, I want to remove all the checkboxes associated with that picture and display a new set for the new picture.

[Code]...

View 3 Replies

Textbox - Identifying Individual Values In A Text Box?

Jan 15, 2011

I want to identify specific strings in a text box from user input to add to a score variable, like so -

[Code]...

The example given adds 1 to the score, but if a user adds a space then a second word the text box views it as a whole and not individual words, resulting in no values added to the score variable.The problem lies with the whole text box being viewed as one entire string. Instead, I want to split it up so word1 will add 1 to the score, word2 will add 1 to the score, etc.

View 1 Replies

C# :: Identifying Click Tags Names Used By An Swf File?

Feb 24, 2011

How can I read the click tags names used by a flash file?

View 1 Replies

Actionscript 3 :: Collecting And Identifying Functions Within An Array?

Dec 28, 2011

I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.

function doSomething(someArg:Object):void {
if (conditionIsFalse){
operationsToDoWhenConditionIsTrue.push(function(){
doSomething(someArg);

[Code]...

Basically if doSomething is called twice, I only want operationsToDoWhenConditionIsTrue to hold the most recent invocation. Obviously since the invocations are wrapped in function(){} all the functions are the same. Is there any way I can accomplish what I want?

View 1 Replies

ActionScript 3.0 :: Identifying Objects Beneath A Given Point?

Feb 4, 2009

How do I determine what objects are underneath a given x or y coordinate on the stage or within a sprite? Preferably, I'd like to be able to do this so that a class that extends Sprite and is a child of the Stage can determine what's underneath a given x coordinate of itself, regardless of position on the stage. This has to be done without user input.

I'm not clear on what methods might make sense for this. The hitTest stuff requires more info than I'm likely to have. Maybe localToGlobal, but to use that, I need to know what the objects are already. There are a finite number of them, so I could have them testing for this all the time, but that doesn't seem right and may not even get me what I'm looking for.

View 3 Replies

ActionScript 3.0 :: Identifying A Clicked Element From MouseEvent?

Dec 9, 2009

I have several array element each assigned to different symbols on the stage and now I have assigned one function (fcn1) for each element's MOUSE_OVER event as follows:.

for(h = 0; h < fields.length; h++)
{
fields[h].addEventListener(MouseEvent.MOUSE_OVER, fcn1);

[code]....

Now in fcn1, I have to identify which element the mouse was over it. I could not do this because I can't pass any parameter to fcn1 other than e:MouseEvent. And I tried to look the properties and methods of e:MouseEvent that might give any information about the source element (in this case, array elements).So far, only way out of this was I create function for each array element which in turn call fcn1 with appropriate parameter, but it is cluttery.

View 1 Replies

ActionScript 2.0 :: Identifying And Locating Event Sub Properties?

Mar 13, 2008

how can i find (possibly with flash ) the listing of sub properties for events?i would not know if sub properties even exist for an event if i'd not done a tutorial stating so.for example.

var listenerObject:Object = new Object();
listenObject.cuePoint = function(evtObj){
trace(evtObj.info.name); //how do i find out if such sub properties exists for events?

[code]....

View 3 Replies

ActionScript 3.0 :: Identifying The Type Of Child For If Statements?

May 9, 2009

taking the time to look at my query:Essentially I want to know what to replace the 1_mc with.

Code:
var various_mc:MovieClip = new 1_mc;
addChild(various_mc);

[code].....

View 5 Replies

ActionScript 3.0 :: Identifying A Part Of Text Brought In By XML?

Jul 13, 2011

I have an html text being brought in from XML to a dynamic text field.  The html text has a <br> in it.  I need an If statement that can detect if the text has the "<br>" in it or now.  How do I do that?

View 8 Replies

ActionScript 3.0 :: Identifying Cause Of Drop In Frame-rate?

Sep 30, 2009

I'm working on a pretty simple game similar to Pingu Throw involving hitting an egg as far as possible. It uses very basics physics and involves a bit of moving some movieclips with bitmaps inside around to simulate a parallax background. For some reason, if you hit the ball at a certain angle, the whole thing slows down horribly (ironically, the slower the ball moves, the bigger the drop in frame rate).

I have no idea why this is occurring and have taken the following steps to rectify the problem with no success:

- tried 'cache as bitmap' both on and off for all the assets.

- disabled all non-necessary objects and methods.

- made sure assets are optimised and of an appropriate size.

I just cant get rid of the slow down without removing the code that is used to scroll the game sideways (pretty essential to the game). I need to get this game done ASAP. Here's a link to a .zip of the files. You'll need TweenMax in your classpath.

[URL]

View 2 Replies

ActionScript 1/2 :: Identifying Naming Conflicts When Consolidating .flas?

Jun 27, 2009

Over the past years I have created many different .fla's of aircraft panels( ie. hydraulic panel, electrical panel, pressurization panel, etc.)  Each .fla has only one panel in it.  Each panel is a movieclip and made up of movieclips, graphics, etc.  It has it's own code built in and the idea was to be able to copy the panel from the original .fla to a new .fla, that contained other panels, and together would become part of a training program for the company. No I wasn't smart enough to uniquely name each asset(switch, guage, light, etc.). I did avoid the default names like symbol1, symbol2, etc.
 
Now I need to take each of the panels from the individual .fla's and put them into one larger .fla to act as a single library for all the panels.  This single .fla will become the master Library that I will link all future .fla's to.  As you would guess I get the "One or more library items already exist in the document:" message when I try to copy and paste a panel(movieclip) into the new .fla.
 
Question:Is there an easy way to identify specifically which items are in conflict  without having to do a direct comparison between each of the libraries?

View 5 Replies

ActionScript 3.0 :: Identifying Marker Overlay In Google Maps

Jan 12, 2011

how to identify which marker overlay is being clicked.

I've looked up solutions online and the only thing that ever traces back for me is [object Marker] I need a way to identify the marker icon and manipulate the icon.

this is the marker code:

ActionScript Code:
function createMarker(latlng:LatLng, number:Number, tip, myTitle, myContent):Marker {
trace(this);

[Code]....

View 1 Replies

ActionScript 2.0 :: Identifying Movieclip Using Another Movieclip?

Jun 8, 2007

Is there a way to identify a movieclip by its relationship to another. That is to say I have one movie clip "ball_mc" that moves randomly around the screen over photos (photo1_mc, photo2_mc . . .), I want as ball_mc passes over a photo?_mc for a textbox to display the name of that particular photo?_mc.

View 1 Replies

ActionScript 3.0 :: Grr Infinite For Loops?

Mar 29, 2009

Shouldn't flash detect these before running the script and crashing and having to force quit and restart (and flash startup takes a while)? Like just give an error: infinite for loop or something? And this happened to me a bunch when working with for loops within for loops, when I accidentally used the same variable for both loops, so of course it never ended and crashed flash.

View 2 Replies

Comparing Arrays And Loops

Nov 29, 2010

The scenario is to create a lotto game that matches 6 user inputted numbers with 7 randomly generated numbers. The 7th number is a special case (eg bonus ball) WOULD LIKE TO SHOW A KIND HEARTED FALSH GENIUS ALL OF THE SCRIPT IF POSS! (its not tooo long) This code works, but it just outputs the default message: There seems to be a problem with my arrays not comparing? Part of the code is: (prioir to this the user inputs numbers, they are copied to text areas beginning with O, on a button press) On a second button press randomly generated number appear to a timer. //compareResult checks how many numbers match between the two sets of numbers to determine winnings.

[Code]....

View 4 Replies

Use The Sound Loops For Commercial Uses?

Jul 25, 2011

I'm new here and I'm wondering if I can use the Sound Loops for commercial uses?

View 3 Replies

Professional :: Using 'for Loops' With HitTestObject() ?

Feb 7, 2011

I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....

However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....

TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()

View 3 Replies

ActionScript 3.0 :: Limit On For Loops?

Apr 1, 2011

I'm pulling data from an xml doc and created 4 XMLLists to hold the children of the 4 different elements. Inside the onLoad function, I created a series of for loops to go through each list. But Flash stops after going through the first two. I'm very puzzled by this. I got around it by creating a 2nd onLoad function for the last 2 lists, but should I be using a different loop? Curious.. I inserted a break after the first 2 and then the 3rd loaded up...

View 1 Replies

Actionscript 3 :: Two For-loops With A Delay?

Jun 8, 2011

I've got the following code and i would like to add an delay of 200 ms after each trace statement

for (var x_pos:uint = 0; x_pos <= 12; x_pos++){
for (var y_pos:uint = 0; y_pos <=12; y_pos++){
trace("hello world " +"("x_pos+","+y_pos+")");

[Code].....

View 4 Replies

ActionScript 2.0 :: Way To Slow Down For Loops

Jul 25, 2004

i am new to flash and i was wondering if there is a way to slow down for loops.Like i can set how many seconds till it goes and loops again. I have tried setInterval but didnt work.here is my code:[code]

View 10 Replies

ActionScript 2.0 :: Hittest, Loops And The Like?

Aug 11, 2004

My situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller!)

View 3 Replies

ActionScript 2.0 :: [fmx] FOR Loops And Function?

Nov 24, 2004

why this code dosent work at the same time in the timeline, and why only envent put inside the attacHMovies or duplicated Movies work, if i put them in the forr loops they don work.

Code:
img01 = new Array();
img01 = ["001.jpg", "002.jpg", "003.jpg", "004.jpg", "005.jpg", "006.jpg", "007.jpg",

[code].....

View 10 Replies







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