ActionScript 3.0 :: Simple Parameter Passing On Event Listener?
Oct 11, 2009
I'm new to ActionScript and have a fairly basic question. I want an eventlistener to call a function and pass it a parameter that will send the movie to a specific frame. My code generates and invalid parameter type error. It's as follows:
TL_AboutUs_btn.addEventListener(MouseEvent.MOUSE_OVER, DropSubMenu(10)); // calls a function to drop a sub menu
function DropSubMenu(sm:number)
{ gotoAndPlay(sm);}
Error is "1046: Type was not found or was not a compile-time constant: number."
View 3 Replies
Similar Posts:
Feb 4, 2009
this is the error I am having:
TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/removeEventListener()
at project1_fla::MainTimeline/btnName()
here is my code:
ActionScript Code:
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;[code]..........
View 1 Replies
Mar 24, 2010
I am a n00b and therefore might get terminology etc. wrong. I am developing for Scaleform (therefore authoring in ActionScript 2.0 for Flash Player 8).
I have a movie clip on stage which is a stack of buttons. I want to create a simple test, I want a function to fire when the mouse is rolled OFF the BtnList movie clip.
[Code]...
View 3 Replies
Feb 1, 2009
I am having trouble getting a simple event listener class to work. The class is:
Code:
package {
import flash.display.Sprite;
import flash.events.*;
[code]...
and I have the ClassPath pointing to the folder that contains this .as file. I do get the trace "In setUp" but I'm not getting seeing any Keyboard events. There also aren't any errors showing up in output so I am kind of stumped.
View 1 Replies
Jun 27, 2010
Is this possible? I have looked around but I can't really find anything.
View 3 Replies
Jan 26, 2009
Let's say I have 10 different buttons, a click on each button will open a different website. Currently, I have 10 different functions for 10 buttons. Is there a way to simplify the code and only have one function for all the buttons and only pass the URL to the onclick function?
button121.addEventListener(MouseEvent.CLICK, clickButton121("http://www.myurl.com"));
function clickButton121(event:MouseEvent, urlString:String):void{
myURL = new URLRequest(urlString);
navigateToURL(myURL);
}
I can say it will be very inefficient if i have 100 buttons and having to write 100 functions.
View 3 Replies
Aug 17, 2009
how do you pass a variable to a listener function? Im trying to add bmp when the mouse goes over this class but i keep getting the undefined error.
Code:
package FlashPackage{
import flash.display.*;
import flash.events.*;
[Code].....
View 2 Replies
Apr 21, 2010
I am wondering what is the way of passing and argument to a listener.. doing something like this:
Code:
myThing.addEventListener(Event.COMPLETE, doThis(arg));
function doThis(e:Event, arg:int){
...
}
What is the proper way, i this doesnt really brake the code, it doesnt work either...
View 11 Replies
Nov 19, 2009
I have one event handler for several object's events. I would like to pass a value through to the function from the event listener:
function chkEmpty(event:Event){
if(event.currentTarget.text==){
thisIsBitIWantToBeAbleChange.text = You haven't entered anything in the box, please try again
hisIsBitIWantToBeAbleChange.setTextFormat(validate_frmt);
}
}
Could I give the event.currentTarget a value that I could test for? So if the value is 1, I effect output1_txt, if 2, output2_txt, etc etc. If so, are there customisable values that I could use that wouldn't do anything to the display object,?
View 8 Replies
Jun 26, 2003
I would like to know if it is possible to pass a clip event on to both the function that has a listener, and to the button that is being pressed. I am finding the listener takes it and thus the button doesn't see it.I found a walk around, however, I'd like to know if it is possible say for one clip event to be seen by both objects?For example, with the mouse over a button the listener function detects the event and carries itself out, however, the button misses the event now.
View 2 Replies
Jun 28, 2011
I am trying to essentially pass a string as a function name into an event listener, but I am not sure how to approach this. Is there a way to convert a string into a function?
Here is some code I have for me to show you what I am doing.
package{
//some import statements
public class changes extends MovieClip{
[Code]....
View 7 Replies
May 12, 2009
I'm using the following addlistener to listen for a custom event the event works if i put e.Event in the functions parameter but i don't get the passed variables however if i go into the .as folder where the dispatch originates and put EventType in the parmeters field of the function then i get all the variables.........but if i put EventType instead of e.Event in the first example then I get undefined for EventType.....how do give access to EventType?
[Code]...
View 7 Replies
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
Mar 26, 2009
I', trying to convert a code from as2 to as3 of the music game "Simon Says"(original source HERE)[code]
View 2 Replies
Jun 15, 2009
Can't figure out why I'm getting this error:Error #2007: Parameter listener must be non-null. I have traced the xml, so I know the values are loading, so don't know why I"m getting a "non-null" error.The first value in the xml traces correctly, but then the error occurs.I only receive the error when I pass the popup argument to createImageHolders, and I don't know why... I"m a 3.0 newb.
Code:
import flash.events.MouseEvent;
import flash.events.Event;
[code].....
View 3 Replies
Jan 16, 2009
How can I pass more than one argument with a listener ?
ActionScript Code:
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, myMethodName);
I would like to have
myMethodName(my parameter);
View 2 Replies
Aug 26, 2009
We are getting ready to start trying to convert our older content to AS3.To this end, I have been trying to develop what I though would be a relatively simple. It just an attempt at an adaptable mc button class that my animators and designers can kind of "plug and play" so I can spread out some of the workload.I keep getting "Error 2007 Parameter listener must be non-null". I understand why its throwing an error. simplified block:
Package{
import flash.display.MovieClip
import flash.events.[code].......
View 1 Replies
Mar 26, 2010
The slideshow its referring to is a something I purchased online and is embedded into my movie.Does it mean I need to put and onComplete function on the page thats loading this? Is it for the xml or the slideshow movie?
Error #2007: Parameter listener must be non-null. at flash.events::EventDispatcher/addEventListener() at slideshow_fla::TheWholeSlideshow_1/xmlLoaded() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
View 16 Replies
Mar 31, 2012
I have had a go at using event listeners. So far I have failed. All I want to do is when I click my mouse on the bird mc it moves.Here is my code:
Code:
package as3test
{
import flash.display.MovieClip;[code].....
And here is the TypeError:TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/addEventListener()
at as3test::movieclip()
View 2 Replies
Oct 9, 2009
I do have some programing background from my past. anyways, on to the error listed in the title. I thought I was getting good with the Timer class, but alas, I think this error has something to do with my Timer embedded in my switch() code block:
[Code]...
View 1 Replies
Jan 20, 2011
I have a question about AS3. I'm new to coding/scripting/AS3/Flash, so I'm sure that I am making some rookie mistakes. I keep getting the following error (I only get the error when I use the if() conditional. If I remove it the code runs fine. But I need the functions to run only under certain conditions):
[Code]...
View 3 Replies
Jun 3, 2009
<mx:HTTPService id="addWeb" resultFormat="object" result="Added(event)" fault="faultWeb(event)" showBusyCursor="true" method="GET" url="http://localhost/search/populate.php" useProxy="false">
[code].....
View 1 Replies
Jan 7, 2010
I have a function setup that I was hoping to re-use to eliminate a bunch of code, but I can't figure out how to pass a parameter to it. I'm getting the trace output, but the rest of the function is not working.Is there a way to get this to work?From what I can tell the syntax matches the examples in the reference guide.
Code: Select allfunction hideButton (elementName:String)[code]......
View 2 Replies
Oct 15, 2004
I'm trying to pass an mc instance as a paramter of a function. is this possible because I keep getting errors.
Code:
function moveCircle(sIncrement:Number, sMovie:String):Void {
sMovie._x +=sIncrement;
}
[Code]....
I'm trying to do this to cut down on redundant functions I've used in the past for simple as movements and controls.
View 2 Replies
Oct 15, 2004
I'm trying to pass an mc instance as a paramter of a function. is this possible because I keep getting errors.
Code:
function moveCircle(sIncrement:Number, sMovie:String):Void {
sMovie._x +=sIncrement;
}
[Code]....
I'm trying to do this to cut down on redundant functions I've used in the past for simple as movements and controls.
View 2 Replies
Jul 7, 2011
I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript's ENTER_FRAME. Basically, I want this event listener to listen "all the time" not just wait for any particular instance (mouse click, keyboard event) of event.
View 3 Replies
Feb 2, 2008
i have 1 PHP page in which i have a Flash animation. this flash swf file, display 2 fields and 1 button.
this php page is called "test.php".
i'm able to send data from Flash to a PHP page, but i would like to send the content of those 2 fields to the "test.php" and display them. however, i do not know how to do it.
i see that it works but i'm not able to display or refresh the PHp page to display the result.
as walkaround i was thinking to collect the webpage address where is executed the flash and to send it to another PHP page. and this 2nd PHP page, will reload the test.php with parameters...
how to get under flash, the address of the actual executed php page ?
View 10 Replies
Sep 3, 2009
I would like to know if is possible to pass a var type as parameter to a function. I have several sounds in library, and I would like to do something like that:
Code:
function PlayMe(soundname:String)
{
var snd:this[soundname] = new this[soundname];
snd.play();
}
View 4 Replies
Oct 23, 2009
i am trying to define a parameter/variable in my html file and pass it through to the embedded swf file:
Code:
<param name="movie" value="index.swf?wmode=transparent&index=XXX">
...
<embed src="index.swf?wmode=transparent&index=XXX" width="200" height="910" quality="high" pluginspage="http://www.adobe.com/shockwave/download
[Code].....
View 2 Replies
Jun 2, 2011
I am new to flex and SAP. I am designing a dashboard in flex. I have retrieved data from SAP query_view_data and I am able to show it in charts. However now I want to pass parameter to SAP web service to retrieve data between two dates. I am trying to this with the following code:
protected function adg1_creationCompleteHandler(event:FlexEvent):void
{
var IInfoprovider:String="0FIGL_O02";
[code]....
View 1 Replies