This is a discussion on Javascript and Flash within the Flash Actionscript Programming forums, part of the Web Development category; I have heard we can invoke functions used in flash using javascript. If its possible please help me in this ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| I have heard we can invoke functions used in flash using javascript. If its possible please help me in this regard and how to use it.
__________________ None of us is As Strong as All of us. |
| Sponsored Links |
| |||
| Read this moock>> web>> flash>> fs command it will give you some idea about flash using actionscript. |
| |||
| Hi...Anand Javascript is invoked in Flash by using GetURL function...For example one button is there u can invoke javascript in button onPress event...The code sample is btn.onPress=function(){ getURL("javascript:alert('button1')"); } Then save the application and publish the flash file in Html..Run the newly published file..while running the application and press the button..then u see that alert window is open for ur browser... Thanks, S.Arun ![]() Less Talk Work More |
| |||
| Hi, In flash there is a way to call a function written in javascript from flash. We can simply call like this. getURL("javascript:function_name('parameters seperated by comma')",""); But we can't return values from javascript to flash. To return value use the function below. var exint = flash.external.ExternalInterface.call("Function Name", Param1, Param2, etc); The return value should be stored in the "exint" variable. To call a function written in Flash from Javascript use see this sample below. Codes to be Written in Flash: import flash.external.*; var methodName:String = "goHome"; var instance:Object = null; var method:Function = goToMacromedia; var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method); var txtField:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 0, 0, 200, 50); txtField.border = true; txtField.text = wasSuccessful.toString(); function goToMacromedia() { txtField.text = "http://www.macromedia.com"; getURL("http://www.macromedia.com", "_self"); } And codes to be in Html page: <form> <input type="button" onclick="callExternalInterface()" value="Call ExternalInterface" /> </form> <script> function callExternalInterface() { thisMovie("externalInterfaceExample").goHome(); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } </script> Regards A.Ramesh |
| |||
| Using FScommands, externalInterface or JavaScript with IFRAME tags or DHTML layers In order for FSCommand, externalInterface or JavaScript to work from a Flash movie in an IFRAME tag or DHTML layer, the browser itself must support these calls. FSCommand with IFRAME was first supported in Internet Explorer 4 and Netscape 6. However, Netscape 6 support of the IFRAME tag was very limited. ExternalInterface is supported by Explorer 5.0 and later, Firefox 1.0 and later, Mozilla 1.7.5 and later, Netscape 8 and later, and Safari 1.3 and later.
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/flash-actionscript-programming/4014-javascript-flash.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 03-16-2008 05:36 PM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| JavaScript to include flash file in asp.net | kingmaker | ASP and ASP.NET Programming | 3 | 03-10-2008 02:20 AM |
| How does JavaScript Reporter differ from JavaScript editors? | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 1 | 09-13-2007 04:59 AM |
| 2D, Flash or 3D??? | 3DProf4online | Web Design Help | 7 | 04-19-2007 07:04 PM |
| Flash | mari10 | Web Design Help | 1 | 03-08-2007 08:10 PM |
| web flash | spain11 | Flash Actionscript Programming | 0 | 03-07-2007 03:43 AM |