473,698 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I call Flash function using JavaScript?

forsiam
1 New Member
I've seen the example in
http://www.thescripts. com/forum/thread694359.ht ml

but I still have problem about javascript. (I use SWFObject)

My Action Script
Expand|Select|Wrap|Line Numbers
  1. import flash.external.ExternalInterface;
  2.  
  3.  
  4. var success:Boolean = ExternalInterface.addCallback("thisMethod",this, test);
  5.  
  6. function test(){
  7.     displayTxt.text = "OK";
  8. }
  9.  

My Javascript & HTML
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="swfobject.js"></script>
  2. <SCRIPT LANGUAGE="JavaScript">
  3. <!--
  4. function pause()
  5. {
  6.     var flash = document.getElementById("mymovie");
  7.     flash.thisMethod();
  8. }
  9.  
  10. //-->
  11. </SCRIPT>
  12.  
  13. <div id="flashcontent">This text is replaced by the Flash movie.</div>
  14.  
  15. <script type="text/javascript">
  16.    var so = new SWFObject("test.swf", "mymovie", "200", "80", "8");
  17.    so.addParam("flashvars", "filename=music.mp3");
  18.    so.addParam("allowScriptAccess", "always");
  19.    so.write("flashcontent");
  20. </script>
  21.  
  22. <INPUT TYPE="button" value="Pause" onclick="pause()">
  23.  
have anything wrong? thank you
Jan 4 '08 #1
0 8524

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4811
by: kevin | last post by:
hi there, can you alter or give advice to the following code . I Basically want to detect for flash player 6 onClicking a button and if flash player is not correct write to screene bla bla bla you are being redirected how do I position the text too? or maybe I should use a popup?:-) I have the onClick function to goto "function version()" How do you embed html into javascript??
3
5632
by: btopenworld | last post by:
I have a Flash movie with parameter 'autoplay' set to false. The movie is started using a Macromedia javascript function via onload. This is OK in IE but Netscape 6 doesn't run the movie - it appears to be waiting for something, even though everything else is downloaded. If I set the movie to autoplay it runs fine but of course begins too early. This is the Macromedia script: function MM_controlShockwave(objStr,x,cmdName,frameNum) {...
1
5285
by: Terry Haufler | last post by:
I am trying to swap/rotate random flash banners using the following Javascript code. I have 3 flash headers/banners. I can get it to open a page with a random header using document.write(randomHeader) in the chooseHeader() function, but the rest of the page doesn't get displayed with that approach. Instead, what I would like to do is comment the document.write(randomHeader) line, and use the random reference I have in the table cell...
18
12688
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
2
4663
by: Anees | last post by:
Hi, i need to invoke a javascript function while clicking a button that is in a flash movie. i hav used geturl() to redirect the page to some other page. but is it possible to call a javascript function from FLASH..?? please help me Regards
13
5322
by: mudgen | last post by:
I have a webpage that has two flash animations running. I also have a javascript script running that rotates 3 images and fades them in and out. To do the fading and rotating in javascript I am using the setInterval function, like this: setInterval(function () {imageFade()},10); This works fine in Firefox, but in IE 7, the flash animations slow down a lot, and the javascript fading/rotation slows down some.
4
2441
by: dupdupdup | last post by:
Hello there, im needed to develop a gallery for this website. im using hotspots to go to my frames in my flash Each hotspot goes to each frame. The flash is loaded properly. When i right click and click play it goes to the next frame. But the Hotspots just dont work with IE. For your information: This works with other browsers like firefox, safari and Opera. MY HEADER <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"...
0
8601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.