473,721 Members | 2,254 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 8529

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

Similar topics

1
4812
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
5633
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
5290
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
12695
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
4666
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
5332
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
2444
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
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
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...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9131
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
9064
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
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...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
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

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.