I'm using FlashBuilder 4 beta2. My base class has a function foo(): protected function foo(s:String, z:String=null): void{} Literally "foo" so that there's no chance I'm stepping on a built-in method. I am getting an "Incompatible override" error when attempting to override the method in a subclass: override protected function foo(s:String, z:String=null): void{} Does the optional parameter do something "behind the scenes" that makes it illegal to override the method?
I want to add things to the display list, some will have event listeners and some not. Is it possible to make an argument optional so it doesn't throw an error if it's not there when calling the function?
im trying to pass in an optional argument into a function. The datatype of this needs to be an object... however, im not getting very far. I know i can do this....
I want to create some functions similar to how GreenSock's tweening class works.With the optional parameters by name in brackets. {}[code]I get this error: "Parameter initializer unknown or is not a compile-time constant."Pretty sure it's the "Parameter initializer unknown", but I don't know what to do about it.
Code: import fl.transitions.Tween; import fl.transitions.easing.*; var animTween:Tween;
[Code].....
I have figured out the following: Well, as you see the function moveStuff accepts three arguments, namely:
objectdurationeasingWhen easing has a default value, I get an error. But if it doesn't have a default value, then it works fine, the code would look like so then:
Code: import fl.transitions.Tween; import fl.transitions.easing.*; var animTween:Tween;
How do I make the color array, dColors, an optional parameter?[code]It gives me a "1047: Parameter initializer unknown or is not a compile-time constant."I've tried a bunch of different ways, but all I get are compile errors.Don't forget to drop a colorpicker control in to your library if you copy out the code.
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.
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."
Let's say I have a Custom Event Class, and it has several Event types stored in static Constant:
[Code]...
Is there an easy way to validate that the type passed to the Constructor is one of the Static Constants of the Class, without having to check it against each value?
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.
When moveBars is called, the length of the 4 colored bars change to indicate how the player is doing in different areas of the game, like so; moveBars(.1,-.2,.3,-.1)
My problem; I need to store the moveBars parameter arguments in XML like so;
<myArgs> .1,-.2,.3,-.1 </myArgs>
But I can't find the way to get those 4 numbers into the moveBars parameters from the XML doc. Is there a way to do this?
Essentially, I have a function with three parameters, that works fine when I type in the parameter values. The function is tweens(MCname, targX, targY) and it runs properly when I use tweens(btn1, 150, 200) for instance. I need the function to move 6 different movie clips, one at a time, and I am using a variable (Counter) and an if statement to tell the function to run again after one of my tween classes finishes. The code all works, and it will run six times with the same clip if I just type in one of the movie clip's instance names as the MCname parameter.
BUT, if I try to use a variable (BTNname) to serve as the MCname parameter, it will not work, making it so I cannot apply the function to my 6 different movie clips. I put a trace on the MCname parameter, and it returns the correct value (btn1, btn2, btn3, etc) but it is not moving the corresponding movieclips. I've tried a number of different methods, but nothing will work.[code]...
I'm trying to program a race timer with OOP, and I've been adding more and morefunctionality to its class. Everything had been running well, until I had the idea to put a countdown() function, to make a cool countdown effect. Things got worse when I wanted to make the countdown function to call another function when the countdown effect has finished.The code runs well when I first pass a function parameter from the Main class to the Timer'scountdown() function. The problem begins when I want that function to be past again on other private function of the same class, because this time, the function becomes nullOn the Main class constructor, I 've written the following line:
I am sending a name of a function via parameters to another function. This allows more usage of a single function. However, the button commands work every-so-often. The message appears everytime with no problem.
Code: _root.msgReveal("This is just a random message. Click the ok button to close.", false, true, false, false, _level0.msgHide(), false);
Simply said, I want to have an inputtextfield, a button that is linked to the textfield and a dynamic textfield as an display, to display stuff, which comes from the inputtextfield and the button.Then, I want to have items in the actionscript, like item1 = 5, or item1 = 1a, or 1a = item1. Just some code that equals to another code. But for now item1 = 5.For the button that is linked to the input textfield, has to calculate something when pressed and the dynamic textfield will display it. So if I would type in the inputtextfield 5 and press the button, it will be as example multiplied by 2, so the dynamic textfield will show 10.
Still following? The point is, I know how to set something like that up, but what I want is that when I type item1 in the textfield (which equals to 5) and press the button the dynamic text will show 10, because "2 x instance name inputtextfield" (in which intem 1 is typed, which equals 5) should be 10 right? But when I try to do this, the dynamic text will show nothing or some error. but when I type directly in the code "2 x item1" and press the button it will show 10. But I want it to double link, so "2 x (instancename inputtextfield which equals to what is typed in the field, this case: item 1 which equals to 5) and not that it stops to item1, so it will freak.
For the record I am running Flash CS4, but am using actionscript 2.0 (its just what I know, and I don't feel like learning 3.0)-So I'm making a contact list, and each of the names will be clickable to bring up more information. There's going to be a lot of names, so I'm trying to keep the actionscript concise. The code is shown below in a simplified form, but essentially I have created a variable for the hexadecimal color, and I have created a function which will change the text color of each of the name buttons. This works, I have tested it. But, I don't want to have to tell the function to run for every single name button
SO - I tried to create a for loop that would run the changeColor function for each button without typing it a million times. The one below should run from "option1" to "option5" for instance. I originally tried entering the equation "option" + i as a parameter, but it did not work. So I tried the code below where the for loop creates a variable which is assigned the value option1, option2, etc. as it runs through the loop. I added the trace code, and it is showing me that MCname is holding the correct value. However, the changeColor function still refuses to insert the MCname variable as a parameter. The testColor parameter is a variable, and that will work, so why not the MCname one? I also tried replacing the MCname variable with the name of a button (option1) and it runs fine. I just don't want to type in every single option name for the entire list.Sorry for rambling, but I'm trying to fully explain the situation.. If the code is all correct, why won't the changeColor function accept a variable for the first parameter? Is there a way I can get this to work without having to copy and paste the changeColor(option, Color) code for every button (there could be over 100 options)
CODE: var testColor:Number = 0x33ff00; function changeColor(buttonName , myColor:Number){
Does anyone know what is the syntax to use for a function's default parameter when it's a Vector? You can easily create a default value for an int or Number or even an Array, but what about a Vector?
I want to be able to send a second (or 3rd) parameter to a function that is called by an event listener, but I can't seem to get it to recognize the parameter - it gives me an error 1067 (implicit coercion of value) when I try the below code.
I have a frame based HTML file in which my SWF is displayed in the left frame.My SWF file has a button that simply,when clicked,displays a HTML file in the "rbottom" frame. Following is the code I used:
var a:String; function aboutmeClicked(evt:MouseEvent):void { var targetURL:URLRequest = new URLRequest("resume.htm"); navigateToURL(targetURL, "rbottom"); } aboutmeB.addEventListener(MouseEvent.CLICK,aboutmeClicked);
Unluckily, when the button is clicked at run-time, the "resume.htm" file is opened in a separate window rather than in the specified frame.