ActionScript 3.0 :: Access MC Instance When We Have Only Its Name As A String?

Jun 8, 2009

I am sending the instance name (i.e. String)of the MovieClip to a function.From that function I need to access that same instance of MovieClip using that name.I have a MovieClip Instance name Planet_mc. And I am sending it to function abc()

abc(Planet_mc.name);
function abc(s:String):void
{

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Access Instance By String Reference?

Sep 6, 2010

I have movie clip Ball what has public function glow[code]...

full access to Ball is MainMenu.ImagesPanel.Ball

I want to send command from server in text like:

string="MainMenu.ImagesPanel.Ball.glow"

How to convert sting to structure?

View 0 Replies

Flex :: Access To Object Property When The Propety To Access To It's In A String Variable?

Oct 20, 2010

It's too complicate to explain but I'll give you an example

I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?

View 2 Replies

ActionScript 3.0 :: Access Values Held By A Class Instance From Another Class Instance?

Oct 14, 2009

I have to admit I pretty much ran away from Flash when AS2 came along and only used it for animation purposes over the last 5 years.So I'm having a major crash course in AS3 in Flash CS3 and I'm not enjoying it one bit. I'm getting maybe 10mins of finished work per hour as I try to figure out the limits and rules of AS3. Quite often it seems that AS3 simply can't do what I want it to. Anyway: Characterchecks.as is the main class and it loads a bunch of XML into four arrays. The file starts like this:[code]If I trace the value of, say, cc._Categories from the main FLA, it's empty. I'm guessing that the next line of AS in the main FLA doesn't wait for the previously called function to complete? (This may tie in to my next problem)My next step is that I want to display various things based on the data in the array. I have another class, Display.as which will hold all the functions to create the items on display. I thought it would be best for these to be a separate object. I wonder if I'm right?

So I declare an instance of Characterchecks in the main FLA and call it cc, and then run the functions to populate the arrays... Now I create an instance of Display and call it cd. How can I get functions in cd to see the values of the variables in cc? And if the main timeline can't tell that the functions aren't finished filling the arrays, how is cd supposed to know?I might be asking dumb questions, or maybe I'm doing things ***-backwards, I don't know. I'd appreciate any help, I really would. This whole thing has me at the end of my tether... being the most technically advanced person in my circle of co-workers and web design friends means I have no-one to explain why things need to be done a certain way or what the best way is.

View 3 Replies

Actionscript 3 :: Set String To Instance Name

Feb 25, 2010

i'm having some problems with as3

[Code]....

this is my code, i'm trying to set the title value for every child instance of eventChild, as i am new to action script in general, and action script 3 in particular i don't really know what i'm doing wrong here. I'm trying to set the text for ev1.title1, ev2.title2, etc. from values in eventChildren like this : first child, sets ev1.title1, second ev2.title2 and so on.

[Code]....

View 2 Replies

ActionScript 3.0 :: Add A String To Name Of Instance?

Feb 1, 2010

I am trying to capture the name of a target and add the letters "hl" on to the end and then set the visibility of another object with this modified name to true. Here is the code. The trace shows exactly what I want. Now how do I take that and set the visibity to true?

Code:

var highLight:String = evt.currentTarget.name + "hl";
trace(highLight);
highLight.visible = true;

View 6 Replies

ActionScript 3.0 :: Converting A String To An Instance Name?

Jun 8, 2009

Code:
//declare variables and create arrays
var initx=80;
var inity=80;


[Code]......

Alright, what I am trying to do here is get 15 buttons arranged on the stage in a random order. The buttons are all named "butt1" "butt2" etc. First step, getting the numbers 1-15 in a random order in an array (successful). Then I concatenate "butt" before the number so the array contains the button names.

However, when I try to place them I get the following message:

ReferenceError: Error #1056: Cannot create property x on String.
at numbersgame_fla::MainTimeline/frame1()

Flash is interpreting my array values as strings rather than the buttons they are supposed to be, and failing as a result. How can I fix this?

View 2 Replies

ActionScript 3.0 :: Using String Var To Reference Instance Name?

Jul 24, 2009

I've got a set of arrays being dynamically generated with paths to nested movieclips. The paths are coming in as strings, and I can't seem to get them to work as movie clip instance variables.as example, a string would be:

siteMC.b1MC.b1f1MC.rMC
(that path works fine outside of the array)

How do I get that kind of nested path from the string to something flash wont spit out as null?

View 4 Replies

ActionScript 2.0 :: Use A String Var To Refer To A Mc Instance Name?

Feb 12, 2009

i am having problems referencing an mc's instance name via a string var. I think the solution would be simple, but i have been trying different things for a while

ActionScript Code:
var hitarea:Array = new Array;
function populatehitareas()

[code].....

View 9 Replies

ActionScript 3.0 :: Convert A String To An Instance Name?

Sep 19, 2010

I'm slowly climbing the AS3 learning curve, I had a query about converting data stored in an Array:

My flash file contains six movieClips arranged into a grid, each movieClip is named with an instance name, increasing sequentially like so:grid1, grid2, grid3 ... etc

What I'm trying to achieve is to have one of the grid items randomly selected to play a contained animation every 2 seconds.[code]...

View 1 Replies

ActionScript 3.0 :: Flash Instance Name From String?

Mar 16, 2004

temp.MissleArt = team1[h].MissleArt;
temp.MissleArt.visible

i have a object(container) with multiple children and based on the units MissleArt i want the objects Child instance visiblehowever when i do this it assumes that temp.MissleArt is a string even tho temp.Arrow is a child of temp (Missleart is equal to arrow)

View 2 Replies

ActionScript 2.0 :: [CS3] MovieClip Instance Name To String ?

Jul 25, 2008

I would like to pass the name of a movieclip to a string so my attachmovie method can work. what I m doin is :

function createBlocks(slot:MovieClip)
{
...
...[code]...

when I call the above function on a keyframe I call it like : this.createBlocks(block4);

block4 is the id name of a movieclip in the library. the problem is that the attachMovie method needs a string as a parameter! how can I convert that to a string? so afterwards, slot , has inside the name "block4" (with the quotation marks)

View 1 Replies

ActionScript 3.0 :: Convert Instance Name To String?

Jul 7, 2009

i have several button that should navigate to frames in my movie. the button have the same name as the frame's labels i need to convert the buttons' instance names to strings

stop();
import flash.events.MouseEvent;
this.Label1.addEventListener(MouseEvent.MOUSE_DOWN ,gotoLabel);
function gotoLabel(event:MouseEvent):void{
gotoAndStop('label1AsString');
}

View 2 Replies

ActionScript 3.0 :: Convert String To Instance Name?

Oct 9, 2009

I have a Flash poetry project in which I have 49 separate dynamic text boxes on stage. Each has a separate instance name - "cell_1", "cell_2", "cell_3" etc. I use the following code to store instance names in an array -

var j:int;
for (j = 1; j < 50; j++) {
instances.push("cell_"+j)

[code].....

View 5 Replies

ActionScript 3.0 :: Flash - Instance Name From String?

Oct 19, 2010

temp.MissleArt = team1[h].MissleArt;temp.MissleArt.visiblei have a object(container) with multiple children and based on the units MissleArt i want the objects Child instance visiblehowever when i do this it assumes that temp.MissleArt is a string even tho temp.Arrow is a child of temp (Missleart is equal to arrow)

View 5 Replies

ActionScript 3.0 :: Possible To Refrence A TextField's Instance Name Using An String?

Jun 4, 2010

I'd like to know if there is a way to reference a dynamic text box's instance name through the use of a string.I know that this["the string"] works for movieclips, but haven't had much luck with the text field.Here's a simplified snippet of code I have so far - The goal is to replace txtInstance with txtInstanceArray[k]

var txtInstanceArray:Array = ["txtInstance","txtInstance1","etc"];
var colArray:Array = ["hitsum","hitsum1","etc"];
for (var k:int = 0; k < 30; k++){

[code]....

View 3 Replies

ActionScript 3.0 :: Create A New Instance Based On String?

Jun 18, 2009

I need to dynamically add some movieclips to the stage. I have some drop downs on the stage which will control what gets added. The value of each selection is the name of each movieclip. How can i take this and create a new instance of the appropriate movie clip?[code]...

View 19 Replies

Actionscript 3 :: Convert Instance Variable To String?

Feb 2, 2011

Is there a simple way to convert an instance variable to a String?

View 2 Replies

Arrays :: Convert String Into An Object Instance Name?

Jun 16, 2011

I'm trying to turn an string into an instance name.

stage.focus = ["box_"+[i+1]];

this gives me back = box_2;

but I need it to be an object not a string.

In as2 I could use eval. How do I do it in as3?

View 3 Replies

Flex :: Air - Find Next Instance Of String In TextArea

Dec 4, 2011

I have a TextArea, a TextInput and a button. When text is entered into the TextInput the TextArea is searched for the matching string, however it only highlights the first found instance of the string. How can I do a 'find next' type of operation.

protected function searchBtn_clickHandler():void
{
text = mainTextField.text;

[Code].....

View 1 Replies

ActionScript 3.0 :: Return Class Instance As String

Feb 1, 2009

Is there anyway to include a function or overrite something in a class that'll output a custom string when the object is called as a string?

So for example if I created a class named "myClass" and I instantiated it:

Code:
var myObject : myClass = new myClass();

When I:

Code:
TextControl.text = "blah blah, " + myObject;
myObject is getting casted as a string. Normally it would output:
"blah blah, [object myClass]"

Is there a built-in function that recast the object as string? Is there anyway for me to change that string output? I know I can just make a public toString() method in the class or something, but just wondering if there was something better.

View 3 Replies

ActionScript 2.0 :: Convert Text String To Instance Name

Aug 10, 2009

so here's my problem. I've got an array (wall_inst[]) containing instance names of 3 objects (for now), however they are stored as text strings. I've got a moving 'ball' object too. The problem is, the values contained in the array are text strings and will not behave as instance names, when I try to get object properties off them etc. Eg, I can do this:

[Code]...

View 6 Replies

ActionScript 3.0 :: Converting String To MovieClip Instance

Nov 4, 2009

I have a slider that the values are passed to a concatenated string.
Example:
trace ("object" + event.value + "_mc");
this gives me "object1_mc"

Now, what I would like to do is use that string to set the alpha to 1
Example:
object1_mc.alpha =1;
It will not work because it is a string and not a movieclip...

View 1 Replies

ActionScript 2.0 :: (OOP) Create An Instance Of A Class By Name (String)?

Aug 7, 2007

In as simple an example as I can think of, I have two classes: Dog and Cat. Both are subclasses of Animal, in this stupid example... I know how to create instances of both, however I don't know how to dynamically create them by name from a string. It would be something like...

[Code]...

View 14 Replies

ActionScript 3.0 :: Turning String Into MovieClip Instance Name?

Jun 4, 2009

I found this code to turn strings into a movieClipInstanceName that exists within a known movieclip.
Code:
// CREATE THE STRING
var newString:String = "movieClipInstanceName";
//CHANGE THE ALPHA OF THE MOVIECLIP TO 0
this[newString].alpha = 0;

However, when using this code for a movieclip within a known movieclip...
Code:
mc1.this[newString].alpha = 0;
...or...
Code:
this["mc1"].this[newString].alpha = 0;
I get this error...
1084: Syntax error: expecting identifier before this.

Code:
this["mc1." + newString].alpha = 0;
...throws this error...
Error #1010: A term is undefined and has no properties.

View 1 Replies

ActionScript 3.0 :: Convert String To Array(Instance Name)?

Apr 21, 2010

how can I convert String to Array(Instance Name)?The code below works fine.

Code:
var gridArray:Array = new Array(sq1_btn,sq2_btn);
gridArray[0].visible=false;

[code].....

View 13 Replies

ActionScript 3.0 :: Convert Instance Name To String,text

Sep 11, 2010

I have multiple buttons, I would like, when the user presses a button, the name of that button is displayed as text on another frame.[code]

View 14 Replies

Access An Instance In A Different FLA?

Sep 28, 2009

I am trying to add a LOAD EXTERNAL MOVIE CLIP behaviour to a button sitting in a .FLA called SERVICESMENU. I want to load a .swf titled MULTIMEDIA.SWF into an instance of an empty symbol called PAGE LOADER on a different .FLA called MAIN.FLA.

The problem is when I am in the SERVICEMENU.FLA file, I cannot see the instances that I created in the MAIN.FLA when following the behaviours wizard so I cannot choose the PAGELOADER instance that was created in and resides in the MAIN.FLA file.

View 2 Replies

ActionScript 3.0 :: Passing A String As A Movie Clip Instance Name?

Oct 17, 2010

I thought this would be a simple one, but i am stumped.  So I resulted to using this less than optimal solution, just to get it working...

if (lobby.gamemap.selectedItem.label == "Map1") map.AddMap(new Map1)
else if (lobby.gamemap.selectedItem.label == "Map2") map.AddMap(new Map2)
//Map1 and Map2 are movie clips in my fla library, with linkage Map1 and Map2

[code]........

View 5 Replies

ActionScript 3.0 :: Make Some Class Instance When Owning Only Its String Name?

Apr 12, 2011

Maybe nonsence but is there a way to make some Class instance when owning only its String name?
 
I mean,
 
function makeClassInstance(className:String):void{
var instance: Class(className) = new Class(className);
}
 
That's all about valueObjects. I wish to retrieve classNames from values setted up in main app for universality.

View 9 Replies







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