Javascript :: Flex Execute A Function When A Certain Trigger Is Executed?
Oct 9, 2010
I am currently using ExternalInterface to call JS functions from Flex. Is it possible to do the same the other way around: have Flex execute a function when a certain trigger is executed in JS? I want to have a Flash app with buttons in HTML that when pressed call functions inside the Flex app.
I have a Flex client application. I need a clean up function to run in Flex when the user closes the browser. I found the following solution on the net, but it only works half-way for me. How could I fix it?CustomEvent triggered, but not executed. >> EventHandler for CustomEvent.SEND_EVENTS is defined by a Mate EventMap. All the handler does is to call an HTTPServiceInvoker. In debug console, I'm able to see the handler and HTTPServiceInvoker being triggered, but neither the resultHandlers nor the faultHandlers were called. I know this event handler has no problem because when I dispatch the same CustomEvent.SEND_EVENTS in a button click handler, it behaves exactly as I expected)Browser seems to wait for cleanUp function to complete before it closes. (all traces were printed before browser closes down)
Code I added the following into the index.template.html window.onbeforeunload = clean_up;
how to execute the code below from a javascript funtion when the body unloads this is a flash function but I would like it executed from a js function.
I'm trying to execute a function like window.alert for example, from actionscript, when both the html file and the swf file are using the file: protocol.without changing global flash security settings
I am trying to make a simple mp3 player using flash. The songs are loaded using an XML file which contains the song list. I have "play" button with the instance name "PlayBtn". I have an actionscript file named "playctrl", the content of which are listed below:
package classes { import flash.media.Sound;
[Code].....
However on clicking the play button, I notice that the function playSong() is called 7-8 times(check by printing an error msg. inside the function) resulting in overlapped audio output and the player crashing as a result. The function should be called only once when the MouseEvent.CLICK is triggered.
Within a specific canvas, I would like a user to be able to press a combination of keys which will trigger an event.(a bit like a cheat in an old megadrive game). Not sure where to start though. Anyone know if it is possible and if so could you give me a clue with how to start?
I have a combobox that act as autosuggestion for a search application. Search function is getting triggered by a search button. I also want to trigger the search function either when the item in combobox is double or single clicked. Code:
I am trying to attach a movie to the swf when a function gets executed. Everything in the function except this is fine, but the movie is not attached. I used this line to attach the movie.
How can I execute the javascript from my flash application? That javascript returns the flash movie (.swf file). I want to load that swf file into movie clip. What control i can use or any way to do that?
I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query
Here is the situation. I have a JavaScript that closes the DIV containing my flash object. It currently closes after 15 seconds. That is supposed to be how long the Flash movie lasts. however, slower machines run the movie longer. this means the flash object closes too quickly and they don't see the entire movie. . . if I increase the time, the users of fast machines have to wait around awhile for the movie to disappear.
So, I would like the movie to execute the javaScript when it gets to the last frame.
My page uses both flash and javascript. Currently, I have a video player which makes use of commands like "videoP.sendEvent('PLAY');". I'm building a new, custom player and have never used the sendEvent() method.I've always used "setVariable" with a listener.
I'd like to NOT alter the code in my html page and make use of it's sendEvent() functionality. So, I guess my question is ... how do I RECEIVE the event? The player is already targeted properly within my html. I just need to tell my flash doc to execute the information it receives.
A website I am developing will have a small animation (say 5-10 seconds minor effect) on the logo at the top of the screen. The logo looks static but when you hover your mouse over it, the animation is played. (This is achieved using the 'button' symbol as the animation within flash).
The client now wants the website's plain text navigation, when hovered over, to trigger the animation to play again. I am a very BASIC user as flash but I believe it is possible to send a javascript call to the swf (i.e. each navigation link will include a "onmouseover=' restartFlashAnimation()'"where I need to define that js function) ...and the swf will recognise the function call and then replay the animation.
My needs are to execute a javascript whitout calling any external function of the html file when a flash button is clicked. I need to obtain the effect that happen when the user put in his address bar the text javascript:"alert("Hello World!"); and press enter I need to do this whitout calling any external functions, whitout calling anything in the html file, all just with the swf. Of course the script that i must call is another than javascript:"alert("Hello World!"); but let's begin with this easy script and when working i can thikn to implement the complex one
i tried this
ActionScript Code: on(release) { function runJS(script:String):Void {
[Code]...
but is not working, i get a syntax error, maybe cuse of the " in "Hello World!"
I want to ask if what i need to do is possible and, if yes, why my AS code is not working.
Is it possible to trigger for example flash uploading button via javascript?For example I have made empty image wrappers and by clicking on them, they trigger flash button to open as select window.
I want a link to trigger a sound click in flash AS3. I've taken the .play() outside of the function to confirm that it works by itself. What am I missing that will let me call an AS3 function from javascript?
Here is my html <object width="5px" height="5px"> <param name="movie" value="play_coin_sound/playCoin.swf?v=5"> <param name="wmode" value="transparent"> <embed src="play_coin_sound/playCoin.swf?v=5" width="5px" height="5px"> [Code] .....
I have such onClick command in my php file:onClick="hideCol(4, true); hideCol(5, true);showDiv('2');return false;"I want the same command to be executed in flash, can I do such onClick command in flash so it will trigger some javascript in php? Basically do the onClick command above but the php file must catch the command.
I want to be able to trigger a click on the "Upload" button in Uploadify - the reason being I'd like to be able to choose to upload a file from a dropdown menu and hence need to call "Upload" somehow using javascript - unless anyone has another clever idea?
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.
In my AIR application in Flex 4, I use mx:HTML, and when I navigate to a location like this ut, some websites have "alert" function in javascript like this :lert('hello world!');nd AIR show the message in a box...I just want to remove, or ignore these messages, but I don't know how...
My web application pass a javascript object to flex application using addCallback function. when the flex application is in modal dialog in safari browser, the object in the flex application is null and when I open the flex application just in a new window, the object is passed correctly. But, I need the showmodaldialog to show the flex application.
The flex code: ExternalInterface.addCallback( "handleEvent", handleEvent ); override public function handleEvent( event:Object ):Object { Alert.show(String(event)); .....
I have a Flash application that receives data from a php application in xml format. Would it be possible for me to call functions in flash that it receives in xml format?
Let's say the php application sends this:-
<data> <command>gotoAndStop(15)</command> </data>
Would I be able to get that function executed in the Flash application?
make function execute only once per second in ActionScript 2.0? As always I'll start from example to explain my problem...I have aprox. 15 buttons on my stageand all of them are calling the same function, but with different arguments. This function executes some effects, that lasts for 1 second. If someone will click on that buttons more often, than once per second, that will look horribleI can disable that button, what was pressed, but this will not solve the problem, be cause someone in a hurry can click another button