ActionScript 3 :: Flex - Calling AddEventListener More Than Once
Jun 2, 2010
I've a little problem, I don't really understand if I can use addEventListener more than one time on the same object (and same callback function) if this case can I have a problem of overflow, or simple flex is so smart to not add again in the same stack same function
How to pass a value to a function while its calling thru 'Montion_change' or 'Motion_Finish' or ....
here I try to pass a value to "tweenEvent function" while that function called... i m using a private variable inside 'mainfunction' (dont tell create that variable out the function ), i just assigning a string value to that variable. after this, i m starting a tween and when the tween started calling 'tweenFunction' using addEventListener,
Inside 'tweenFunction' function, i try to trace the 'Name' variable which is inside the mainfunction... not working
When i call stage.addEventListener from Document Class (i.e. the entry class to the program) it works. But now i have changed the structure to something like: Document Class pulls PlayScreen (which is of type movie clip). In this PlayScreen, i call stage.addEventListener, but it gives me error saying: Cannot access a property or method of a null object reference. so how do i go about it. basically, i want to add a stage event listener for keyboard event.
How to pass a value to a function while its calling thru 'Montion_change' or 'Motion_Finish' or ....here I try to pass a value to "tweenEvent function" while that function called... i m using a private variable inside 'mainfunction' (dont tell create that variable out the function ), i just assigning a string value to that variable. after this, i m starting a tween and when the tween started calling 'tweenFunction' using addEventListener,
Inside 'tweenFunction' function, i try to trace the 'Name' variable which is inside the mainfunction... not working.Here my code....
import fl.transitions.*; import fl.transitions.easing.*; function mainFunction() {[code].....
I'm doing everything by the book (I think), I've reviewed this problem multiple times, but I can't seem to get it fixed. The creationCompleteHandler function is b
I have an actionscript class MyClass that extens NavigatorContent. I instantiate the class as a custom MXML NavigatorContnent component for an Accordion component. MyClass has a Button component that I have tried to attach an event listener to. I want the event to bubble so that I can have the handler in the Accordion component.
I have a boolean variable, projectsLoaded that is set to false when my application loads. As i'm sure you can imagine, when the final project module loads, I set the variable to be true. Is there a way I can trigger a series of functions to run once that variable is set to true?
I have ItemRenderers that need to listen for events. When they hear an event (and when data changes), they dispatch an event with their current data value. As item renderers are reused, each of them is going to add its callback in set data(value...)and pass the callback function in the event as well as the current data value. So, the listener of the item renderer's bubbling event will set someEventDispatcher.addEventListener("someEvent", itemRendererEvent.callbackListener). This will happen more than once. Does setting the same event listener on the same event for the same dispatcher waste resources? Does the displatcher see that it already has the listener?
Suppose I have an application and a global event listener in it. Should the key events, who are fired in the PopUp, be caught by that listener? Or maybe popups are not placed in that hierarchy?Here's simplified test-code for you to understand what I'm talking about:
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"> <mx:Script><![CDATA[ private function init():void {
i used systemManager.addEventListener in sub application...... it is working well....but when i load sub application into main application through swfloader it doesnot working..
I have a Javascript API, which should be usable with GWT and Flex. Using the FABridge it is really easy to call Javascript methods from AS3 and vice versa. But when I try to register a callback to an AS3 method in my Javascript API I get stuck. Here is a short code sample:
In our flex/air application we are calling a web service over https.The web service is java based and has, at the moment, an untrusted certificate.When doing a POST to the service with some json, the payload on the server side is pretty garbled.A popup does occur asking whether you want to continue and even when I do and add the untrusted certificate into my keychain (on the mac), the data sent through always comes through mangled.I installed charles http proxy to see the actual traffic and it seems at times I'm getting a SSLHandshakeException back...I'm guessing this is causing the garbled data as ssl isn't being setup properly.
in this package i am attempting to add the shadow, which works, and then add the infobubble, which works, and then add a main swf which works, and then add a close_button.swf which it does load the swf; however, when I try to add the listener, I am unable to make the infobubble close back up.
I have a function which makes a call to the server to load some financial data. This data is then displayed in a grid. In order to keep displaying the latest data I keep making this server call (every 30 secs). I'm using a Timer object to do this. The problem I have is that I have to wait 30 secs when the application starts for financial data to be displayed, what I'd like to happen is that the load data call is made, then start the update timer. Is there a way to set this up or shall I use to data load calls, one to get the initial data, then one to get the updates, which is made every 30 secs?
Flex portlet is calling a webservice and I am intercepting the calls to check the session credentials using XFire AbstractHandler method implementation. But I am not getting the same httpsession value that is used for login in to the application. I have intercepted the calls using TCPmon also.
I need to call javascript function from Flash 4 based web application. When I run it in Debug mode it runs perfectly but when I make release build or run same application on other machine it does not call JavaScript function.
I wanted to know if there are ways to use dispatchEvents with custom event function calls without actually instantiate the function in an xml form but doing so in the script. What I am trying to do is, have a developer use my custom component button, but add his/her own function to what is already added to my own click event call. so just as a case he/she wants to add there own validation function of that click event. One way i have it is where i create an instance in my component within the xml schema.i have a mxml component called DialogWindow.mxml and inside I have
In the "cancelAction" function I add the dispatchEvent to cancBtnClick as this will be the userdefined function.
protected function cancelAction(event:Event):void { dispatchEvent(new Event("cancBtnClick")); PopUpManager.removePopUp(this); }
When deriving the component DialogWindow.mxml from another component, I can use this statement where myFunction is taken place of cancBtnClick in cancelAction function.
// from TestButton.mxml <cmp:DialogWindow cancBthClick="myFunction()" />
The above works fine, but what if i want to call it using derived class call in a script. such as
public var dialogW:IFlexDisplayObject = null; (dialogW as DialogWindow).cancBtnClick = "myFunction"; // this is an instance of DialogWindow
When trying this, of course there is no cancBtnClick. So i know i am not implementing this correctly.
The problem i am facing right now is a filename.php generates filename.xml.... and this filename.xml is called in my Flex Tree.Now everytime i update my DB, the values are not getting reflected into filename.xml unless i call the filename.phpNow how would i call filename.php from flex which will make the update of xml
If all I have is an instance of an object, can I call a static method of its class? For fun, let's say I don't know what the name of the class is, only the name of the static method.
I created an application to show a datagrid with a custom column in Flex 3. How can I access the method loadDetails in this code?:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ public function loadDetails(id:String) : void { // Some code here
[Code].....
When I tried to run this code Flex throws an error. It says that loadDetails is not defined. I suppose that error is because of scope.
I am embedding a swf file into the parent swf file and my code in parent swf file want to call the function inside the embedded swf file. It always failed, below is the code. The error is in line:
var player:testflv1 = (loader.content as SystemManager).application as testflv1;
It can't be compiled because the testflv1 is not recognized as the known type.
I have a WCF web service (using basicHTTPBinding) which I am connecting to from a Flex application. I am using the FlexBuilder code generation to make a proxy for the web service.This has been working great until I tried to call a method on the web service that has no parameters. Here is it's interface declaration:
I then started getting HTTP 500 code responses from the service.Inspecting the HTTP response with Fiddler shows that WCF is reporting the following error:
Error in deserializing body of request message for operation 'GetCurrentDateTime'. The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true)
So it seems that there is an incompatability between Flex and WCF whan calling methods that have no paramaters - Flex doesn't include anything in the message but WCF is expecting something to be there.Is there any way to configure either Flex or WCF to work around this or am I going to have to include dummy parameters in such operation contracts?
I've inherited an application and am fixing a bug. There is a refresh button in a the application's mxml file and it has a click="refresh(null)". This works.
However we also want to do a refresh every five minutes automatically using a timer. There is code in an .as file (that is sourced' into the above mxml file) that uses a Timer and calls refresh(null) from within the .as file, but this doesn't seem to do anything.
Is this the right way to do this? Or do we need to explicitly reference the object we want to refresh? If so, how do we do that?