ActionScript 3.0 :: Naming Mc With Parameter?

Feb 5, 2009

I have created a function to load up my movies what I would like to do is two things

(i) change the ldr to a movieclip

(ii) add an extra parameter to add an instance name movieclip when I call the movieclip

loadMyImage('images/headers/logo.png', 80, 20 );
function loadMyImage(imageURL, xPos, yPos) {
var ldr:Loader = new Loader();[code]....

View 4 Replies


Similar Posts:


Actionscript 3 :: Skip An Optional Parameter And Assign Value To The Parameter After The Skipped One?

Dec 14, 2010

Can we skip an optional parameter and assign value to the parameter after the skipped one?

For example I have a function:

public function Dialog(message:String,title:String="Note",dialogsize:int=99):void
{
}

I can easily call the function with a message and a title:

Dialog("HELLO","Intro");

Is there a way to skip the title and just pass in the dialogsize? I've tried it but can't make it work:

Dialog("HELLO",,dialogsize);

Is it possible to skip some optional parameters without using (rest) parameter?

View 3 Replies

ActionScript 3.0 :: Read A XML File And Check A Parameter For Duplicates Of That Parameter In The File

Dec 8, 2009

I am trying to read a XML file and check a parameter for duplicates of that parameter in the file. There could be up to 200 entries with this parameter which is a number. How can I check to see if there are any duplicates?

View 2 Replies

Call A Function With Event Parameter When Have No Event Parameter To Pass?

Aug 14, 2009

Forgive me for this stupid noob question but I want to call a function (loadList) that originally gets triggered after a mouseevent from another function (addToXML) that does not have an event.

The loadList function takes info from a XML var, sticks it into an array which then gets loaded into a tile list and that is working fine.

The addToXML function when called adds elements to the XML var after which I want to call the first function with the event parameter so it refreshes the items in the tile list.

I know it can do this by creating a new array and loading that into the tile list in the addToXML function, but it be much simpler to just recall the function.

I have tried things like

Code:
addToXML.addEventListener(Event.COMPLETE, loadList);

but all the event constants I have tried give me error messges like "1061: Call to a possibly undefined method addEventListener through a reference with static type Function."

View 3 Replies

ActionScript 3.0 :: Naming A Variable?

Aug 26, 2009

Code:var StringMine:String = "hello";And i want to use the value of that string, 'hello' to name a new variable, i thought like this,Code:var [StringMine]:String = "One";but not supprisingly, it doesnt work...

View 2 Replies

AS3 :: Way To Array Index Naming

Mar 11, 2010

I thought that there was a way to be able to name array indexes. Like instead of myArray[0], it could be myArray["tileFour"]. I thought that instead of using index numbers one could use index words.

View 1 Replies

ActionScript 3.0 :: Dynamic Naming Of Mc's?

Jul 25, 2011

i have an array of coins that are layed out on a map for a character to come pick up.i have the coins displaying on screen but i cant get a simple hit test to work. it only seems to work on the last coin created, i presume because the 'i' value hasnt been appended to the name. i knew how to do this in as2 but dont know the syntax for as3. ive attached the file for you to have a look at.

code:
rectangle_mc.startDrag();
rectangle_mc.x = mouseX;
rectangle_mc.y = mouseY;

[code]...

View 4 Replies

ActionScript 3.0 :: Naming In Loader?

Dec 13, 2009

loader is display object but I could not set name to loader. In the documentation loader does not have property of "name". How to set name for loader instance. Example

var imgColl:Array=new Array("1.jpg","2.jpg");
var i:Number=0;
while(i<tot){

[code]....

View 2 Replies

ActionScript 3.0 :: Naming From A Loop?

Aug 8, 2011

is it possible to add variables and name them according to position in a loop? for example how can I do something like this:

[Code]...

View 5 Replies

ActionScript 2.0 :: Naming The MC In A MC When Attach Them?

Apr 18, 2005

I need to change porperites on MC that is in a MC I just attached something and for some reason I can't seem to find out how to get an instance name into them or to just use the one thye have in the library.

View 7 Replies

AS3 :: IDE - Dynamically Naming Movieclips?

Sep 23, 2009

Ok, I've been climbing the walls trying to figure this out, looked everywhere for an answer, learned a few bits and pieces along the way, but still can't do it.I've made my Class which is a little movieclip called 'block', it's fine and does what I tell it to do ie. I can reposition itstretch itotate it and stuff.The problem is.. I want to make more of them and reference them individualy so I can change the properties of them individualy ie, the x and y values etc.

for (var i=0; i<2; i++){
var newBlock:blocks = new blocks();
this.addChild(newBlock);

[code].....

View 6 Replies

AS3 :: Variable Naming With Loops And Arrays?

Aug 1, 2009

I am wanting to create an array. 10 values in it (couting from 0 index to 9). Each 'place holder' will have a corresponding value to it;s index i.e.

myArray[0]=0
myArray[1]=1 etc...

I can do that in a for loop. But then I want to attach each value to a single variable name. I then want to change that each variable to a string. I then want access to all the variables outside of the for loop.

var i:Number;
var aArray:Array = new Array();
for (i=0; i<10; i++) {

[code]....

The output error is 1084: expecting identifier before aArray.

View 1 Replies

ActionScript 3.0 :: Automatic Instance Naming?

Oct 29, 2009

When I instantiate a new object I want the object to automatically be named the same as the name used in the instantiation.var fred:Person=new Person();trace(fred.name); // traces "fred"Is there a reference I can use in the Person constructor to do this?

public class Person extends MovieClip {
public function Person() {  name = ??? // what goes here? }}

View 1 Replies

Flash :: Is There An Accepted Naming Scheme For

Jun 5, 2011

I'm working on a framework for game development in flash and I'm wondering if there's an accepted naming scheme for the main tick / update method name and a name for the functions to call before and after?I can think of:

onPreTick(), onTick() and onPostTick()
onPreFrame(), onFrame(), and onPostFrame()
onPreUpdate(), onUpdate(), and onPostUpdate()

[code].....

View 2 Replies

Flash :: Create/naming Var Dynamically?

Jun 6, 2011

or some reasons i need to create var dynamicaly.

Exemple

I have first an Array wich i want to use to "compose" my vars names

myArray:Array = new Array("aa","bb","cc");

In my final project this Array is created from a xml.

I want to do something like this, but doesn't work...

var ["myvar" + myArray[0]]:Sound = new Sound();
var ["myvar" + myArray[1]]:Sound = new Sound();
var ["myvar" + myArray[2]]:Sound = new Sound();

[Code].....

View 1 Replies

Actionscript :: Filenames - Naming Of Files

Dec 6, 2011

i create an application using Adobe flex 4.5 for recording videos and i was wondering how to give appropriate names to my files produced. What i was thinking is to give the current timestamp which is unique what's your opinion, is there a better solution and how can it be implemented using actionscript?

View 1 Replies

Actionscript 3 :: Naming The Buttons Components?

Apr 2, 2012

How to name through AS3 buttons components?I have 3 buttons components: a BackButton, a ForwardButton and a PlayButton.I have named them through the properties panel, (where it says 'Instance Name').But once I click on them and check for event.target.name I receive, always 'button_mc'.How could I name the buttons?

View 1 Replies

ActionScript 2.0 :: Naming More Than One Instance At The Same Time

Feb 6, 2009

what is the quickest way to name more than one instance at the same time as i have 84 in total and they have to be named:

MC1 - instance name: 1
MC2 - instance name: 2
MC3 - instance name: 3
MC4 - instance name: 4
MC5 - instance name: 5
etc etc...

View 2 Replies

ActionScript 3.0 :: Dynamic Naming Or Whatever It's Called?

Nov 7, 2009

I'm curious if there is dynamic naming for variables, arrays, functions and whatnot in AS3. Below are Perl examples of what I'm asking about. It should be pretty explanatory.

[Code]...

View 3 Replies

ActionScript 3.0 :: Id / Naming Dynamic Instances

Aug 4, 2010

I'm producing an array of thumbnails onto the stage from xml, all works fine, but I need to give them a unique number, starting from 0 etc. I believe I'm doing this right but I'm trying to trace back the ID/number from a mouse event...and keep getting the highest number for all of my instances.[code]

View 6 Replies

ActionScript 3.0 :: Naming Children In An Array?

Jan 4, 2011

I made a thread a couple days ago, but dont think i explained the problem well enough. What im trying to do is name each of the children.

Child 0 = A
Child 1 = B
Child 2 = C

all the way to Z. Then start at A again.

ActionScript Code:
function moveBubble(Event) { // This function handles the movement of the bubbles
if (!inPlay) return;

[code]....

View 7 Replies

ActionScript 3.0 :: Naming Multiple Movieclips Using .name?

Mar 13, 2011

I am working on a little project where I have this:

Code:
for (var py:int = 0; py < 6; py++)
{

[code]....

View 2 Replies

ActionScript 2.0 :: Naming MCs And Setting Properties

Feb 22, 2003

i have a problem whenever i name a movie and set its properties. whenever i use eval on the name it works,

[Code]...

i've heard you shouldn't use eval anymore because it's deprecated, and that you should use this[object]._property instead, but it's not working for me--am i doing it wrong?

View 6 Replies

ActionScript 2.0 :: Button Naming And Positioning?

Jun 17, 2007

I am trying to assign meaningful names to buttons in a for loop based of the var mainBtn.mName. This would normally be easy but i need to to get the width of the buttons before it (the bold code) to work out the position of each button, any ideas how i can do this?

Code:
for (i=0; i<folder.length; i++) {
var mainBtn:MovieClip = mainMenu.attachMovie("button", "button"+i, i);
mainBtn.mName = folder[i].attributes.name;
mainBtn._x += mainMenu["button"+(i-1)]._x+mainMenu["button"+(i-1)]._width+btnSpacing;

View 4 Replies

ActionScript 2.0 :: Naming Frame Variables?

Jul 29, 2007

I created a slot machine and it works properly but i need it to do more. Currently when you spin the Reel, if you get any 4 of a kind its a jackpot. I need it so if you hit 4 "7's" lets say its different than hitting 4 "Bar's".On the main reel I have 4 frames with movie clips, each having a different (chip) and the end. I have set the random() function on them so it is completely random on how they hit. So my question is...how do I set a variable name for the frames so I know that frame 1 is a "bar", frame 2 is a "7", frame 3 is a "cherry" and so on. That way when I write the "if" statements, I can compare them so a "7" is better than a "bar".

View 2 Replies

ActionScript 2.0 :: Naming Parts Of Xml To Call?

Apr 9, 2008

i created a flash menu that calls its items from an xml document. the menu items are images that scroll within the menu movie clip depending on mouse position. my problem is that, when clicked, each of these menu items needs to call a pretty complex function.

so this seems like a really basic question, but, is there a tag or something i can use in the xml file to like, name each of the items so that i can write functions with them individually with my actionscript in flash?

View 1 Replies

ActionScript 3.0 :: Dynamic MovieClip Naming?

Dec 22, 2008

I am just getting started with AS3 and have run into a problem. I had a way of attaching movieClips from the library to the stage in AS2 that used the old attachMovie() function where I would run a for loop and it would duplicate the moviclip to the stage and dynamically create new names for the new instances.I now am using this:

var myCube = new cube();
addChild(myCube);
Then, I can access the myCube instance's properties like this:

[code]....

View 9 Replies

ActionScript 3.0 :: Dynamically Naming Variables?

Aug 31, 2009

Is it possible to dynamically name a variable? Like set a certain string as a variable name wouldn't think so but just in case.

View 2 Replies

ActionScript 3.0 :: Dynamically Naming Functions?

Aug 31, 2009

Code:
public function btnU1Out_Handler (event:Event ):void {btnUOut_Handler(1);}
public function btnU2Out_Handler (event:Event ):void {btnUOut_Handler(2);}

[code]......

View 4 Replies

ActionScript 2.0 :: [FMX] Naming The Mcs From An Array With AttachMovie?

May 9, 2010

I'm creating some mc's on the stage with the attachMovie function in a loop. I have no problem naming them like that:

foo.attachMovie("myClip", "myClip"+i, 200+i);

But I need to name them with part of an array like that:

foo.attachMovie("myClip", "myClip"+array[i]+"_mc", 200+i);

I thought that would work but I guess my synthax is wrong. How do you mix strings and arrays elements inside the () of the attachMovie?I need to get something like: myClipArrayElement1_mc for the name of the attached movies...

View 2 Replies







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