Wrox Home  
Search P2P Archive for: Go

  Return to Index  

flash_programming thread: FUNCTION CALL


Message #1 by "Claudio Pallone" <pallone@l...> on Sun, 13 Oct 2002 22:14:52
Hi Wolfgang

I found the fscommand in Flash. Now if I want to call a Javascript 
function called doIt(); with no arguments where do I put the call??

on (release) {
    fscommand ("");
    fscommand ("");
    getURL ("");
    fscommand ("");
}


cheers,

Claudio


> Hello Claudio,

Tuesday, October 15, 2002, 5:27:34 PM, you wrote:

PCKS> Hi Wolfgang and many thanks for your reply.


PCKS> Please note that I am using DreamWeaver to create the button and not 
Flash. So I think the best option is to use the fscommand to call 
javascript in my html-page. But how do I do that??

PCKS> I would really appreciate it you elaborated a bit more on that. 
Please find below source code of my htm page

PCKS> Cheers,

PCKS> Claudio

PCKS> <html>
PCKS> <head>
PCKS> <title>Untitled Document</title>
PCKS> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
PCKS> </head>

PCKS> <body bgcolor="#FFFFFF" text="#000000">
PCKS> This is a Flash button test. Click it to call a Javascript function 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
PCKS> 
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c
ab#version=4,0,2,0" width="93" height="33">
PCKS>   <param name=movie value="button1.swf">
PCKS>   <param name=quality value=high>
PCKS>   <param name="BASE" value=".">
PCKS>   <param name="BGCOLOR" value="#FFFFFF">
PCKS>   <embed src="button1.swf" base="."  quality=high 
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?
P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"
PCKS> width="93" height="33" bgcolor="#FFFFFF">
PCKS>   </embed> 
PCKS> </object> 
PCKS> </body>
PCKS> </html>




PCKS> -----Original Message-----
PCKS> From: Flash Programming digest 
[mailto:flash_programming@p...]
PCKS> Sent: 15 October 2002 00:02
PCKS> To: flash_programming digest recipients
PCKS> Subject: flash_programming digest: October 14, 2002


PCKS> -----------------------------------------------
PCKS> When replying to the digest, please quote only
PCKS> relevant material, and edit the subject line to
PCKS> reflect the message you are replying to.
PCKS> -----------------------------------------------

PCKS> The URL for this list is:
PCKS> http://p2p.wrox.com/list.asp?list=flash_programming
PCKS> FLASH_PROGRAMMING Digest for Monday, October 14, 2002.

PCKS> 1. Re: FUNCTION CALL

PCKS> ---------------------------------------------------------------------
-

PCKS> Subject: Re: FUNCTION CALL
PCKS> From: "Development EuroWebBiz.net" <dev@e...>
PCKS> Date: Mon, 14 Oct 2002 09:34:55 +0100
PCKS> X-Message-Number: 1

PCKS> Hello Claudio,

PCKS> Sunday, October 13, 2002, 11:14:52 PM, you wrote:

CP>> Hi,

CP>> I have created a flash button using DreamWeaver but it allows me only 
to 
CP>> create an <a> link.

CP>> What I would like to do is to call a function when the user clicks on 
this 
CP>> link like: onClick="doIt()"; target="main"

CP>> Does anyone have had the same problem before and know the answer??

CP>> Cheers,

CP>> Claudio 
CP>> ---
CP>> Change your mail options at http://p2p.wrox.com/manager.asp or 
CP>> to unsubscribe send a blank email to 

PCKS> Hi

PCKS> there are two ways:
PCKS> (1) write the function in ActionScript in Flash and call it in
PCKS> the onRelease event handler.
PCKS> (2) use the fscommand to call javascript in your html-page.
PCKS> If you need more info reply or try www.flashkit.com

PCKS> Regards,
PCKS> Wolfgang




PCKS> ---

PCKS> END OF DIGEST

PCKS> ---
PCKS> Change your mail options at http://p2p.wrox.com/manager.asp or 
PCKS> to unsubscribe send a blank email to 


PCKS> BMRB International 
PCKS> http://www.bmrb.co.uk +44 (0)20 8566 5000
PCKS> ____________________________________________________________
PCKS> This message (and any attachment) is intended only for the recipient 
and may contain confidential and/or privileged material. If you have 
received this in error, please contact the sender and
PCKS> delete this message immediately. Disclosure, copying or other action 
taken in respect of this email or in reliance on it is prohibited. BMRB 
International Limited accepts no liability in
PCKS> relation to any personal emails, or content of any email which does 
not directly relate to our business.

PCKS> ---
PCKS> Change your mail options at http://p2p.wrox.com/manager.asp or
PCKS> to unsubscribe send a blank email to 

Example:
in Flash you must insert the fscommand, e.g.
fscommand("MessageFlash","Hello JavaScript - movie starts now !");


the html page reads:
...
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function testvideo_DoFSCommand(command, args) {
  var testvideoObj = InternetExplorer ? testvideo : document.testvideo;
  //
  if (command == "MessageFlash")
  {  
    alert (command +": " + args);
  }
}
// Hook for Internet Explorer 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
          navigator.userAgent.indexOf("Windows") != -1 && 
navigator.userAgent.indexOf("Windows 3.1") == -1) {
        document.write('<SCRIPT LANGUAGE=VBScript\> \n');
        document.write('on error resume next \n');
        document.write('Sub testvideo_FSCommand(ByVal command, ByVal args)
\n');
        document.write('  call testvideo_DoFSCommand(command, args)\n');
        document.write('end sub\n');
        document.write('</SCRIPT\> \n');
}
//-->
</SCRIPT>
...


the function name in the HTML java script must have your movie name in the 
first part
(in the example it is "testvideo").

All this is explained in the Flash MX help file.
In your case you must change the script in your button1 movie and in
the html page.
-- 
Best regards,
 Wolfgang
 mailto:dev@e...


  Return to Index