ActionScript 2.0 :: Creating Unique Instance Names For AttachMovie?

Aug 16, 2007

I'm currently making a TicTacToe game to help build my Flash experience and I've come across an issue. I'll try and explain what everything is doing in my code thus far. I know it's a lot of code for a forum post, but I don't want to leave anything out as someone may have a really nice way to work with this.

Code:
this will be switched to a user defined value (1 or 2), depending on which person the user decides should go first. currently it is set up for the 2nd player to go first

new _global.whosTurn();
_global.whosTurn = 2;

//this sets all cells DISABLED so, at the beginning of the game, any cell is selectable
cell1_isUsed = false;
cell2_isUsed = false;[code].....

View 4 Replies


Similar Posts:


ActionScript 3.0 :: AttachMovie - Give Each Instance A Unique Name

Oct 1, 2009

How do I convert the following into Actionscript 3.0. I want to give each instance a unique name.

[Code]...

View 4 Replies

ActionScript 3.0 :: Give Unique Instance Names To Multiple Children?

Jun 18, 2009

give unique instance names to multiple children of the same object?

I have a sprite that I would like to use action script to create 3 instances of on stage and then control each separately.

View 6 Replies

ActionScript 3.0 :: Dynamically Creating Objects With Unique Names

Sep 13, 2009

I want to create object instances based on user input but I can't figure out how to get a unique variable name for each instance (I want to be able to get at and manipulate them later). In other languages I would usually just use an eval() function to pull this off.

[Code]....

Code: 1119: Access of possibly undefined property charlie through a reference with static type poundConuter. poundConuter.mxml

View 1 Replies

ActionScript 3.0 :: Creating Instance Names In For Loops To Reference Later?

Dec 22, 2009

I create buttons, but I am trying to give them each instance names so can target them individually but I keep getting undefined property error.

Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var menu_items:Array = ["CHAPTER I","CHAPTER II","CHAPTER III"];

[code]....

View 1 Replies

ActionScript 3.0 :: Creating Instance Names For Dynamically Created Movieclips?

May 28, 2011

I am trying to use a for loop, to place 5 instances of the same movieclip on the stage. In the loop I used .name to give each movieclip a unique instance name. But when I try to reference one of those instance names in an event listener I get an error. Here is an example of what I am trying to do:

Quote:

var xPos:int = 120;
var yPos:int = 60;
for (var i:Number = 1; i<=5; i++) {

[Code].....

This code generates an error saying that the cStar2 property is undefined. In the example above, does the for loop create 5 copies of the movieclip starC_moov, and give them unique instance names cStar1, cStar2, cStar3, cStar4 and cStar5?

View 1 Replies

ActionScript 3.0 :: Instance Names And Variable Names: It Goes Deeper

Mar 20, 2011

I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.

Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by

trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);

the output window gives me

drawer
instance2

Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:

drawer.x can be set;
instance2.x can (as we know) not be set.

But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?

I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?

View 8 Replies

ActionScript 3.0 :: Dynamic/unique Variable Names In A For Loop?

Jun 24, 2009

am trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one?here is the code
 
/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void {    XML.ignoreWhitespace = true;    var songs:XML = new XML(e.target.data); 

[code]....

View 3 Replies

ActionScript 3.0 :: Dynamic/unique Variable Names In A For Loop

Oct 4, 2011

im trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one ?

/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void {    XML.ignoreWhitespace = true;    var songs:XML = new XML(e.target.data);   

[code]....

View 2 Replies

ActionScript 3.0 :: Unique Names For TextField Created In For Each Loop?

Jun 23, 2010

I have an for each loop that creates a new textField for each item and I need to know how you can give each textField a unique name so it can be targeted later on.Here is the relevent code:

Code:
var i:int = 1;
for each (var titleElement:XML in titleList) {

[code].....

View 3 Replies

ActionScript 2.0 :: AttachMovie With Names From An Array

Jul 8, 2010

I'm trying to reduce repetition in my code by using a for loop with an attachMovie call. [code]So I have a bunch of clips in array that I want to attach, and I just want to use the name of the clip as the instance name, but it doesnt seem to work.

View 3 Replies

ActionScript 2.0 :: Objects - XML - Creating A New Instance Of An Object That Uses An Identical Name To An Older Instance Delete The Previous Instance?

Mar 20, 2009

Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?

View 1 Replies

ActionScript 1/2 :: AttachMovie Using Variable Target And Source Names

Mar 23, 2010

I've frequently used variable names for the target but is it impossible to do this:[code]I can't get it to work and I haven't been able to find an example.It doesn't work without the square brackets either.

View 6 Replies

ActionScript 3.0 :: Unique Instance Name For Different Objects?

May 30, 2011

Is there anyway to have unique instance name for different objects at different frames..?

View 3 Replies

ActionScript 3.0 :: Create Unique Movieclip Tree From An Instance?

Jul 2, 2011

I have a structure of movieclips, which is something like:

Top Level: My character's collision movieclip, stickman_root

Second Level: On each frame of the top level, the visual part of the character, in a different pose. stickman_stand, stickman_walk, etc

Third level: in each of the poses in the second level, the character itself is built of several smaller movieclips. stickman_head, stickman_torso, stickman_upperarm_l, etc...

So having created this structure, I'd like to be able to use it as a template. I'd like to turn an instance of the toplevel into a new, unique library symbol, and similarly everything under it should also get a new unique symbol, so I can modify those as needed without messing with my template. So that I can take this stickman template, and change the graphics to create someone less stick-ish, while still retaining the skeleton and animations I made. Create unique movieclip tree from an instance?

View 3 Replies

ActionScript 2.0 :: Instance-variable (array) Is Supposed To Be Unique

Oct 21, 2004

I encountered a rather irritating problem yesterday. I wrote a class. The class has got 1 variable of the type :Array. its a public variable.On the scene i have 2 movieclips which are connected to my class through its linkage in the library.My problem is that even though the instance-variable (the array) is supposed to be unique for the instance only it gets overwritten for every new instance i create.for example. if i assign the first instance's array 2 values (1, 1)and the do the same with the second but here i change the values to (2,2) then when i check my first instance it has got the same values as the second instance...that is (2,2). [code]

View 2 Replies

Flash Piano - How To Get Each Instance Of Button To Play Unique Sound

Jun 15, 2009

I'm using flash CS4. I am trying to make a piano. It will be the header of a web page when the mouse rolls over a key the appropriate note plays- ideally the key would appear to be pressed as well. I have a jpg of a piano keyboard imported as a graphic. On a new layer I have made a button whos over state has a blank keyframe. I have imported that button to the stage and given the instance a name. I have attached a sound to the over keyframe (middle C).

I have dropped a second instance of the button onto the stage and given it a unique name. When I attach the next sound (D pitch) to the over state it changes the original middle C. How can I get each instance of a button to play a unique sound? I have tried using a new layer for each button but that didnt work. Do I have to make a brand new button for each note? I have reduced my design to include only 16 notes (I originally wanted 32 but I thought that may take too long to download)---

View 7 Replies

ActionScript 3.0 :: Creating Unique TextFields In A For Loop?

Oct 28, 2008

I have a for loop that runs depending on the length of an XML file. What I want to do is create a unique text field for each run through of the loop, and give it it's own position on the stage, and finally assign it the text from an external text file that is specified in the XML file. Everything I know how to do except creating the textfields.

Quote:

for(var i:int = 0; i < blogXMLList.length(); i++)
{
var txtHolder:TextField = new TextField();
txtHolder.x = textX;

[Code].....

This code creates only one Text Field, but then replaces it's text with new text with each run through.

View 4 Replies

Creating Unique Analog Clock Animation?

Oct 26, 2009

I've just created a draft animation demonstration of a unique analogue clock [URL]. What I would like to achieve is to also have a digital clock just below it. So when you roll over the analogue clock, the animation starts for both clocks. When you roll off the animation stops leaving the time displayed exactly the same on both clocks. So basically both the clocks run simultaneously (speeded up). How I might achieve this?

View 4 Replies

Flex :: Creating New ArrayCollection To Generate Unique Variable Name

May 11, 2011

How do I create a new arraycollection that can generate a unique variable name? Like:
AC+nu as in AC1:ArrayCollection
AC+nu as in AC2:ArrayCollection
AC+nu as in AC3:ArrayCollection
AC+nu as in AC4:ArrayCollection
nu++;

View 2 Replies

ActionScript 2.0 :: AttachMovie - How To Get Y Position Of Movie Instance

Feb 1, 2004

How to get the _y position of a movie instance generated by the AttachMovie method? I'm trying to do something like this.
_root . mc full of attachedMovie instances . one of those clips . _y
The path I'm really using looks like:
_root . text . infoblock4 . _y

View 3 Replies

ActionScript 2.0 :: Creating A Grid > AttachMovie?

Aug 8, 2003

I'm trying to create a grid of instances of (74x56) clips, and each one of the created instances must be named and numbered in an order so that it goes from left to right, top to bottom. I have been trying this with attachMovie and duplicateMovie, but unable to figure all out. can someone give me a hint?

View 14 Replies

ActionScript 2.0 :: Use Instance Names Such As '1-1'

Mar 17, 2010

I have a grid 8 columns, 3 rows.I used instance names such as 1-1, 1-2, 2-1, 2-2, ect to easily identify each cell. I can call the movieclips within them without a problem by doing this["1-1"].gotoAndPlay(1); but how do I go about calling them when I can't use "this"? "1-1".gotoAndPlay(1); does not work.

View 2 Replies

IDE :: How To Replace Instance Names

Jan 26, 2009

In the first frame I have 60 buttons with each having a actionscript in it using the instance name "A1". What I need to know is how can I REPLACE the instance name from A1 to B1 in 60 buttons in my NEXT FREAME?

Is there an easy way to do it rather than typing one by one?? I used the "FIND AND REPLACE" option but it replaces A1 to B1 in both the frames. I need to alter the instance name only in the second frame. How can I do it?

View 3 Replies

IDE :: Instance Names Given In The Editor?

Apr 26, 2009

I have two buttons, they're both movie clips, and have identical code except for their names. When I place one of each on the stage and give them instance names, they come up output:

[Code]...

View 1 Replies

ActionScript 1/2 :: VAR Instead Of Instance Names?

Sep 14, 2010

How to write the following AS codes using VAR instead of instance names?

my_Input_Txt.onChanged = function() {  _root.my_Dyn_Txt5.text = my_Input_Txt.text;_root.my_Dyn_Txt6.text = my_Input_Txt.text;}; 
_root.my_Dyn_Txt5._visible = false_root.my_Dyn_Txt6._visible = false_root.MDT1._visible =

[code]....

View 7 Replies

New AS File Won't Recognize Instance Names

Jul 15, 2009

I get the error "Access of undefined property menu_bar" when menu_bar is an instance name directly on the main timeline. I'm not sure how I would call it in the other class. It also isn't exported for actionscript is that the problem?

I have it imported to my document class as:

var mouseClicks:MouseClicks = new MouseClicks();
addChild(mouseClicks);

Then the class looks like this:

Code:
package{
import flash.display.MovieClip;
import flash.events.*;

[Code]....

View 2 Replies

ActionScript 3.0 :: Instance Names Getting Changed

Mar 4, 2010

I know I've read something about this here before but I can't find it, so for Mr. Thicky here, I have dragged some buttons on my stage - each one is actually an instance of the same movieclip. In the IDE, I have given them instance names like 'myButton1', 'myButton2' etc. I've then grouped all these buttons together into a single container movieclip called 'buttonHolder'. Now, in my code, I am trying to retrieve the instance name of the button I have clicked on:

[Code].....

View 3 Replies

CS3 Give Instance Names Quickly?

Jun 3, 2010

I have 100+ of the same movieclips on the stage at the same time, all positioned differently.i'm getting really tired of clicking on one of them, then clicking in the instance name box then typing "i65", then clicking on one of them, then clicking in the instance name box then typing "i66"...

is there anyway flash can fill this information in for you? or a plugin anyone's heard of? this isn't really an actionscript question, I'm not so fussed about selecting the different movieclips based on getChildAt or any of that stuff, I'd just really like a faster way of assigning instance names.

View 1 Replies

Shortcut To Assigning Instance Names?

Oct 22, 2010

I have a 4x4 set of square buttons that I need to give instance names to. They will be named 'btn_1' thru 'btn_16'. Is there any shortcut to assigning the names or do I have to go through 16 times clicking on the button and clicking down to the 'instance name' text box?

View 2 Replies







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