I'm having some trouble passing parameters with a function that is itself being passed as a parameter.In my application code I'm instancing that class five times:they are buttons in a menu.In that class, I've got an onRelease handler that does a number of things when a button is released, one of which is to invoke a function that is defined in the application level of the code.My problem is that I don't know how to send the function parameters.In my StandardButton class I have:
class StandardButton extends MovieClip { /* define properties */[code]..........
The function is successfully being "sent" to the StandardButton class, but without any parameters.How can I send parameters to the class instance with the way I've got this architected.
i'm new of AS3.i've a function in which i create some var like:var str_Foto_tn:String="";then i make a parse of a xml and i put a node value into my var.then i've another function that make a MC and addChild that MC on stage.. the name of that MC is my str_Foto_tn.But he can't see the var... how i can do?
I am a middle school teacher and a newbie in Flash Actionscript. I am trying to create a countdown timer for use in my class during tests. The start and pause functions work as required, but not the pause button. When I click on the pause button, the timer is reset to 0:00:00.[code]
I have a function call as shown here: ActionScript Code:c.draw(colorRead.population); In this function, I would like it to be able to print out population as part of the string for my toolTip. Note, what is in the parameter here may not be the case in every of the instance I need to create.
I'm sure this must have been covered 100's of times but I have searched and searched with no joy so... I'm trying to simply pass a value into a function using a MouseEvent, CLICK (the example below is just that an example not what I'm actually trying to do)[code]...
this is a standalone AIR app which runs off of usb media to help people organize their personal information. there is an XML file in a separate folder which stores the name of a file that the user uploads to usb media (into yet another folder), in this case, the person's living will. getting the path to that file as it differs from mac to pc has been a challenge and i feel the only way around this is to give a conditional for the operating system (second function below).
My immediate goal below is to get the name of the file (VALUE) over to the openThisFile function so that "fileName" can be given a value appropriately in the second function code for mac. I can't figure out how to do this...Alternately, is there a way to manipulate "currentTarget.data.toString()"? I was thinking that could also help me... it has the full path to the file, which unfortunately does not work on Macs... for some reason it just can't locate the file (unless I'm missing something).
Quote:
public function handleLoadData(event:Event):void { try { propertyFilePath = path;
How to display the correct digits. For instance, if the answer is 97%, I want the display to show 97, not 11. Please feel free to view the SWF or look at the FLA file to see[code]...
I'm trying to pass an array of X arrays as parameters to a function such as :
var someArray = [0, 1, 2]; var someOtherArray = [A,B,C]; array = [someArray, someOtherArray,...]; myMC.someFunction(array);
The problem is that the function doesn't see where the 1st array stops, it's like passing a big array such as
myMC.someFunction(someArray,SomeOtherArray, ...) becomes myMC.someFunction(0,1,2,A,B,C) instead of myMC.someFunction([0,1,2],[A,B,C]);
I even tried to make a string such as str += "[array[0]]"+","+"[array[1]] ..but it still passes everything as one big array....how to pass X arrays to a function??
I have a hard time getting this Code: var whichXML:String = "category1"; loadFirstTime(whichXML); function loadFirstTime(whichXML:String):void { XMLLoader = new URLLoader(); XMLLoader.load(new URLRequest(whichXML + ".xml")); }
This is what i want to be able to do, only i can't... And i don't want to have a loop when i call the method executing the methods in my children. Hints?
Code: this.executeMethod([Function(methodInChild)], ArrayOfChildren); private function executeMethod(_methods:Array, _instances:Array):void{
I have an external log file which name changes each session, with the format XXXXX.log
I need to load it inside a swf to show its data, but each time the logs name is different, I need to open the .fla, changing the name of the file and then republishing the swf.
So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:
Code: var logNumLoader:URLLoader = new URLLoader(); logNumLoader.dataFormat=URLLoaderDataFormat.VARIABLES; logNumLoader.addEventListener(Event.COMPLETE, loadedLogNum);
[Code]....
While I cannot assign the value of logNum to the last function, the .log cannot be opened.
I'm sure that I'm doing something daft here - I just need to remove a child that's created in the constructor through an event listener.My code is below but does not work. Can someone point me in the right direction please?
public class Main extends Sprite public function Main() super(); var rectangleIndex:uint = this.getChildIndex(playerBackground)
I´d like to know how could use the Timer class extended.I´m trying to pass a parameter to the constructor function, so I can use it inside the listener.
Here´s example:
[CODE] package { import flash.utils.Timer import flash.display.DisplayObject public class ChangeColorTimer extends Timer { public static const CHANGE_COLOR:String = "changeColor"; public var obj:DisplayObject public function ChangeColorTimer(delay:Number, repeatCount:int, obj:DisplayObject ) { super(delay, repeatCount) this.obj = obj } } } [/CODE]
That was the ChangeColorTimer that extends Timer.Now, I´d want to know how would I use ChangeColorTimer.I thought it was the same as using Timer.I´ve tried this:
[CODE] public function changeColor(mc:MovieClip):void { var colorTransform:ColorTransform = new ColorTransform() colorTransform.color = 0xEE0000 mc.transform.colorTransform = colorTransform var changeColorTimer:ChangeColorTimer = new ChangeColorTimer(400, 1, mc) changeColorTimer.addEventListener(ChangeColorTimer.CHANGE_COLOR, setNormalColorListener) changeColorTimer.start() } private function setNormalColorListener(e:Event):void{ trace("called") } [/CODE]
I called changeColor, but, I don´t get "called" in the output from the setNormalColorListener listener.
i want to pass by reference so i can use this variable outside the function.
What im doing is creating a global variable such as var cont:int; and then in a eventListener like enter_frame (stage.addEventListener..) calling a function called "mover", this function modifies "cont" value and i just want to print this value modified. The issue is i cant pass the value by reference just by const :S. The function is void, but if i change it to return int, its useless because each time i call the function, the value i want to return its created each time with a new value, beacuse i need to declare it so.. I read i can use a var such as Object but i really dont get it (im used to c++ i have to say)
I'm making a tile game in flash and I need to pass event.currentTarget (the current tile) into a new function which sends the tile back to it's start position.[code]I need to call this function from other places in my code..I've tried passing the object itself to another function as a variable but it loses it's start position information !