Probably a misleading title. I meant function, not name ><I have a number of colour buttons in a custom made colour Picker. Each one has a name likecb0000FF, cbCC3333 etc, corresponding to the hex value. I'm having to make a function for each button like this though:Actionscript Code:else if((cb99CC00)==e.target) return;Is there a way to have only ONE else if function, such as Actionscript Code:else if((cbNNNNNN)==e.target)return;Basically referring only to the "cb" and then any combination of 6 random numbers = N?
I don't know what basic knowlege i missing here.I have two compiler error and don't know what to do about it.First says ") or , expected"Secondly "The class or interface 'BitmapData' could not be loaded."
I'm trying to get this one function to be able to call many functions (not at once, but call many possible ones)In other words, I'm trying to get this variable to be named as a function. That way, this one variable can create multiple functions.example:
actionscript Code: class Thing extends MovieClip{ var funcvar; var othervar; function onLoad() funcvar = "YYY"; othervar = "ZZZ"; function onEnterFrame()
I understand that you make an event listener and an event handler, but I do not understand how to create a function were I can hold down a key and the object keeps moving until the key is up.With the following function it only moves it every time I press a certain key. I need to move while the key is held down until released.
stage.addEventListener(KeyboardEvent.KEY_DOWN, jumpEvent); private function jumpEvent(event:KeyboardEvent):void { if(event.keyCode == 17)
I want to create a function that can create new MCs. I have a movieClip exporting as "Box" in my library, and I want to add an instance to the stage called "box"... like so:
Code: function addNewMC (instanceName:String, mcName:MovieClip) { instanceName:mcName = new mcName; addChild(instanceName); } addNewMC(box, Box);
but that does not work! I think it's something small, but I'm not sure what. I'm going to use this function for a bunch of different MCs, which is why I want it to by dynamic.
Is it possible to create variables with a function? I don't mean create my own variable in a function but actually have the function create a unique variable name (eg. exam1, exam2 and so on) they would all have the same data type.
How would one go about creating a function inside a for loop that does not have a button action attached to it while still having access to the current index number.
This code was found on senocular:
Code: var curr_button; for (var i=1; i<=3; i++){ curr_button = this["button"+i]; curr_button.num = i;
[Code]....
This is all great however i would like the functions to just be regular old functions, not button actions (onPress), is this possible?
I was hoping somone good tell me how to create a "playtoAndStop" function. Essentially, what i want the function to do is play from the current point and stop at a designated frame or label. I do not want to have a stop command in the actions panel to serve as the stop as that would interfere with the functionality that this function is intended to serve. If anyone could provide a solution to this function that should have been included with AS3.
I've begun development on a isometric game, and have what I thought to be the hard part out of the way - the map generation from external files, screen-to-isometric conversions, etc. However I'm getting stumped on the "easy" stuff.Basically what I'm trying to do is this. Create a function that will add an object to the map (stage), then add an eventlistener so when it's clicked on, it gets added to the player's inventory. Lets take this sample code:
Code: public function addObjectToWorld(o:IsoObject):void { // ...code to add it to the world
I create this : function money () {total++;income.text=total;} and a button. income.text is added by 1 each time the button is onRelease. I need only 1 point to be added no matter how many time the button is pressed.
I have a number of cases where I have a tween happening in ActionScript, but I would like it to happen after a delay from the event that triggers it. At the moment I'm creating this delay by having a tween that does nothing (eg. an "_x" tween for which the start and end points are the same) and then using tween1.onMotionFinished = function(){to create the one I really want. Is there a way to create this delay more neatly?
So here goes my stackoverflow debut... (And I tried searching and reading thru a lot of posts (php flash date) before asking this)I would like to make an swf that will find out what date it is and do sometinhg correspondingly. Eg. go to a specific frame or load a movieClip.I would also like to avoid the Actionscript "Date Class" because I need to feel fairly certain that my end user will see the swf of the day not of his/her local date-setting.So I'm thinking to somehow bring in php with 'echo date' inside the swf and then have the result create a goto-(or load-)command.
To make matters worse I have to rely only on code within the swf using ActionScript2 (in CS4 or 5). I am not able to publish any outside php (or any other code for that matter) so everything must be done internally. Only swf has to work regardless of server (I am expecting the server will work with php)So I hope some gurus here will be able to tell me:1. If this is possible2. How I make the date thing happen in Flash3. And how I somehow grab the date as a variable (?) and make that determine some action.
I have created a function that creates a pop-up text box: I have named instanceName as a String but sadly it doesn't work. The only way I can get it to work is to name the instance within the function. Is there any way of creating a variable for the instance name? [code]...
is it possible to create a loader and add parent to it,outside of a function or is there a function that runs once when the movie is started that i could add things like this into
i am looking to create something similar to the str_replace function (from PHP) that will replace all occurrences of the search string the replacement string from within an larger string. Does anyone have something like that created already (save me the time)?
ie var myStr:String = new String( "i wish i were an oscar meyer weiner" ); var myOutput = str_replace(myStr, "i", "we"); // myOutput would now = "we wish we were an oscar meyer weiner"
If I create a function which calls someLoader.loadClip(...) many different times for different clips and files that I have created, does the system create a seperate thread for each call or does it load one by one ?