ActionScript 3.0 :: Instance Name As An Argument?

Oct 17, 2009

function test(myI,myX):void {
myI.x = myX;
}

lets say i have an instance name BigWindow so i use test(BigWindow, 100); but it doesnt work,

function test(myX):void {
for(var i = 0,i < 10,i++) {
BigWindow + i.x = myX;
}
}

and i have an instances named from BigWindow1 to BigWindow10.so i use test(100);it doesnt work too.what's the correct way of doing this two?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Passing An Instance Name Argument Into A Function?

Sep 29, 2010

Well I want to set up a function that will calculate the x position of where my MovieClip's instance name will go. Here is the code i currently have.

function xBtnPosition(btnName: String, btnXpercentage: Number):String
{
var xFinalPosition: String = -(((btnName.width * btnXpercentage) / btnName.scaleY));

[code].....

View 3 Replies

ActionScript 3.0 :: Constructor Argument For Instance Already On Stage

Mar 4, 2010

I have a Sprite in my library that is linked to a class (lets call it SomeClass), and i put on stage in Flash, and name the instance someClass. In my Main.as i then write:
var myClass:SomeClass = this.someClass;
SomeClass.as has a constructor with the same name as the class, however it require an argument. How do I pass that to the class when I made an instance of it directly in Flash by dragging it to the stage? (instead of the usual ... = new SomeClass(arg); )

I tried something like this:
myClass.SomeClass(arg);
But that gives me this error:
1061: Call to a possibly undefined method SomeClass through a reference with static type SomeClass.

View 2 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 3 :: Constructor To Assign Instance Name From Super Constant When Adding Instance In Flash IDE?

Jun 17, 2010

I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?

package
{
import flash.display.MovieClip;[code].....

The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.

View 1 Replies

ActionScript 3.0 :: Name Every BounceUp Instance The Same Thing And Then Just Add That One Instance Name To The List The Collision Detector Checks?

Dec 2, 2010

I have a BUNCH of bumpers of four types bounceUp, bounceDown, bounceLeft, bounceRight. during a collision which you hit determines the bounce so they always do the same thing so here's my question.....can i just name every bounceUp instance the same thing and then just add that one instance name to the list the collision detector checks?

i just dont wanna go through and name a hundred each of bounceUp s and bounceDown s individually as the potential for screaming increases proportionally.......

View 5 Replies

Flash :: Play Movie Clip Instance Inside Of Button Instance?

Apr 16, 2011

I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:

function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);

[code].....

View 2 Replies

ActionScript 2.0 :: Possible To Scroll Graphic / Movie Instance As Well As Text Instance In Flash

Jul 19, 2004

Does anyone know if it is possinle to scroll a graphic or a movie instance as well as a text instance in flash. I want to scroll text and images as well. Actually text with imges embedded in it.

View 3 Replies

ActionScript 2.0 :: Use Local Instance Variables Vs Attach New Properties To The Instance Object?

Mar 14, 2006

I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:

1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.

2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.

It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:

[Code]....

View 4 Replies

ActionScript 3.0 :: Instance Or No Instance - Call A Function From Another Class?

Jan 26, 2009

I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:

[Code]...

Does one way free up more memory or enhance performance?

View 5 Replies

ActionScript 3.0 :: Argument Passing To A .exe?

Feb 26, 2012

I have a .swf file through which i am passing arguments to .exe file which is basically a C++console application, how is it possible, should i tweak the sourcecode in th application file for it to accept the arguments passed?

View 1 Replies

ActionScript 3.0 :: GotoAndPlay With An Argument

Jul 30, 2011

I've got all the major peices of my project but I need a steering wheel! I'm not sure how to enable the functionality of the app. Let me try to explain: I have 2 working getTimer timers in 2 class files. One is a 15 minute countdown timer. The other is a timer to call animations, but (here's the problem)i have 4 different sets of animations to call based on the users button selection. They are added to the stage with

ActionScript Code:
var countdown:CountDown = new CountDown(time_txt);//where time_txt is a TextField on the stage
addChild(countdown);
var Alerts:sniperAlerts = new sniperAlerts();
addChild(Alerts);

They kinda have to be called to the stage in this manner because I have some buttons that alter the time on the fly based on the Alerts and countdown var. I tried having 4 different alert files, but you can't declare them all as the Alerts var if you use different frames. In addition you can't repeatedly call the countdown timer as the same var because of namespace. I wish I knew how to make menu_mc to pass an argument to the stage that selects which animation set the alerts timer will process. Here's the alert timer with 1 set of animations to call:

[Code]...

View 0 Replies

CS3 Send An Argument With A Tween Event?

Mar 17, 2009

What I want to do is to remove an item from the array targetArray when the tween hitFade has finished. I added a MOTION_FINISH event to the hitFade tween which calls the spliceTarget function. I wanted to send an argument to the function indicating the targetArray index to splice, but apparently I'm not allowed to send any argument.

how do I send the targetArray index (i) along to the spliceTarget function?

I'm guessing that I could put i into a global variable and use that in the spliceTarget function, but that seems kind of roundabout.

Code:
var hitFade:Tween = new Tween(targetArray[i], "alpha", Strong.easeOut, targetArray[i].alpha, 0, 1, true);
hitFade.addEventListener(TweenEvent.MOTION_FINISH, spliceTarget);

[Code]....

View 8 Replies

ActionScript 3.0 :: Put 2 Objects As The Argument For A With Statement?

May 6, 2010

Is there any way to put 2 objects as the argument for a with statement. example:

[Code]...

I am aware I can use the statement like this code: with(bodyWrapper.fld){} Just wondering is there was a way of adding multiple objects to make typing shorter.

View 2 Replies

ActionScript 3.0 :: Calling Argument And Use It As Class Name?

Aug 4, 2010

My question is, can a function bring in an argument and then use that argument as a class name? Here is an example:

Actionscript Code:
package {
import flash.text.Font;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
public class embedTest extends Sprite {
[Code] .....

Basically, if I have a swf with:
Actionscript Code:
var example:embedTest = new embedTest(Font1);addChild(example);
Can the class file bring in Font1 and use it as the class name.

View 8 Replies

Argument Count Mismatch On Sixties FLA

Jul 6, 2009

I do not understand what is happening. This is the error I am getting:
ArgumentError: Error #1063: Argument count mismatch on sixties_fla::60s_1/forward(). Expected 0, got 1.
And this is the actionscript I am using:
pre_btn.visible = false;nex_btn.addEventListener(MouseEvent.CLICK, forward);
pre_btn.addEventListener(MouseEvent.CLICK, backward);
function forward() { nextFrame();
}function backward(){ prevFrame();
}

View 1 Replies

ActionScript 3.0 :: Get Argument For OnFinishTween's Function?

Mar 20, 2010

is any way to get argument for onFinishTween's function   ?!

[Code].....

View 5 Replies

ActionScript 3.0 :: Argument Error After The First Sequence

Jun 8, 2011

Ok I have gotten this far but it throws an Argument Error after the first sequence.

[Code]...

View 3 Replies

Flex :: Pass A Set Function As An Argument?

Nov 11, 2009

How can I pass a 'set' function as the Function Object argument of another function?eg:

public class IdModel
{
private var _id:String;

[code].....

View 1 Replies

Flash :: Invalid Argument IE 8 JQuery

Apr 17, 2010

I have this particular script that runs so that the flash elements don't show up on top of my slide out navigation. This redraws that flash element with wmode as opaque and so it shows up under the navigation. Works perfectly with Chrome and FireFox but not with IE. In IE I get an Invalid Argument in jquery.min.js code 0 Line 103 char 460. Can anyone help me as to why? If I comment out the second line of code inside the function then there is no error, but then doesn't work in FireFox.[code]

View 1 Replies

ActionScript 3 :: Flex - Use An Argument As A Type?

Nov 28, 2010

I have a movie clip in my library linked with a class name "MyClass", and I am trying to do something like this in Actionscript 3:

function createbtn(bclass:Class):void{
var addB:bclass = new bclass();
addChild(addB);
}
creatbtn(MyClass);

But, I get this error: "1046: Type was not found or was not a compile-time constant: bclass."

View 1 Replies

Flex :: Argument To Nativeprocess Failed

Nov 29, 2010

I need to pass the "" to the mm.exe that run with nativeprocess. When I pass "In From MIDI Yoke: 1" even using " to the nativeprocess, it won't launch the application properly and caused it to crash. What wrong this the code?

[Code]...

View 2 Replies

Actionscript 3 :: Pass Argument In AddEventListener?

Apr 12, 2011

How do I pass arguments using ActionScript's event-listener?I have code, as given below, which creates a label, and I want, when clicked on the label it should pass the toolTip associated with that label. This is what I was trying to do:

public function create_folderpath():void
{
for(var i:int = 0; i < fm_model.absolute_path_ac.length; i++)

[code].....

View 1 Replies

Actionscript 3 :: Single Constructor Argument?

Jun 20, 2011

let's say I have a class:

public class SomeClass{
var name:String;
public function SomeClass(n){
name = n;
}
}

If I do var s:SomeClass = SomeClass("test");, it tries to convert a string to SomeClass. How do I prevent it from doing that?

View 2 Replies

Actionscript 3 :: Get The Argument's Type Of A Function?

Sep 29, 2011

I want to guess the type of every argument from an anonymous function, something like mapping a class with reflection but just for a function, something like...

public function guessMyArgumentType(f:Function):void {
for each (argument:* in f.arguments) {
trace(typeof(argument));

[code]......

View 1 Replies

ActionScript 3.0 :: Passing More Than One Argument With FlashVars?

Sep 28, 2009

I had been trying finding a way to passing more than one arguments using FlashVars. Below is the snippet of HTML code, using this parameter:

HTML Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,

[code]....

View 3 Replies

ActionScript 3.0 :: Argument With Event Listeners

Oct 19, 2009

let's say i have a function that is

function myFunction(argument1:int, argument2:int):void {
trace(argument 1 + argument2);
}

i can use myFunction(1,2); to get a trace of "3" but if it's a mouse event, or timer event, or anything myMC.addEventListener(MouseEvent.MOUSE_DOWN, myFunction); we can't put arguments in this because it would have been

[Code]....

View 2 Replies

ActionScript 2.0 :: Passing A Function As An Argument?

Jan 12, 2004

I have a global function that does some stuff with a LoadVars in it.I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded.Is there a way to pass a function reference to a function so that I could do something like that :

[AS]
_global.function myFunction(maybeFunction)
{
myLoadVars = new LoadVars();

[code]...

View 1 Replies

ActionScript 3.0 :: Passing An Argument Using AddEventListener?

Jul 28, 2009

The transition from AS2.0 to 3.0 has been a long and broken trail for me.

Is there a way to pass arguments to a function via addEventListener, like (but unlike) this: timerTurn.addEventListener(TimerEvent.TIMER, moveUnit, "unitname", "unitdirection")

where moveUnit is the function I want triggered, and "unitname"/"unitdirection" are the arguments?

View 1 Replies

ActionScript 3.0 :: Argument Count Mismatch?

Mar 12, 2010

i need to get a number and an Event to a function but I'm failing to add the code to add the number value when i call the function :

my code:
Code:
var loaderBODY:URLLoader = new URLLoader();

[code]...

View 3 Replies







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