RE: [flexcoders] Is there a javascript flashObj.callFunction(), like setVariable?

2005-04-28 Thread Matt Horn





Just one gotcha to watch out for... Mozilla doesn't 
recognize getVariable/setVariable. It must be GetVariable/SetVariable (note 
capital initial letter). IE will allow either one.

matt

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Abdul 
  QabizSent: Thursday, April 28, 2005 12:52 AMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Is there a 
  _javascript_ flashObj.callFunction(), like setVariable?
  Hi Tracy,There is no callFunction(..) like method for 
  flash activeX or plugin. Butthere is setVariable(..) method. Yes, 
  you can set a variable or setter from _javascript_ using 
  setVariablefunction. I have create a example, it allows you to execute 
  flex functionfrom _javascript_...It's very basic example but you can 
  adopt similar approach and do it more OOway by creating classes in JS and 
  AS...1) FlexJSExample.jsp%@ taglib uri="FlexTagLib" 
  prefix="mm" %HTMLHEADmeta 
  http-equiv=Content-Type content="text/html; 
  charset=ISO-8859-1"TITLEFlex-JS Communication 
  Demo/TITLEscript 
  language="_javascript_" //this function return to 
  Flash ActiveX Object or Plugin depending uponbrowser//it takes care 
  for browser type and returns the proper reference.//Accepts the id or name 
  of OBJECT or EMBED tag respectivelyfunction 
  thisMovie(movieName) { // IE and Netscape refer to the movie object 
  differently. // This function returns the appropriate syntax 
  depending on the browser.  if (navigator.appName.indexOf 
  ("Microsoft") !=-1) { return 
  window[movieName]; } else { return 
  window.document[movieName]; 
  }}/**###**///success 
  flag, set by flash/flex appvar bFunctionCallFinished = true;//param 
  delimiter, kind of unique stringvar paramDelimiter = 
  "--$$###$$##$$--";//this function would call a flash/flex 
  function.function callFlashFunction(functionName, 
  paramsArray){ if(bFunctionCallFinished) 
   { //Get 
  the reference so activeX or Plugin. var 
  flashObject = thisMovie("flexApp"); 
   bFunctionCallFinished = 
  false; 
  flashObject.SetVariable("functionName", 
  functionName); 
  flashObject.SetVariable("functionParams",paramsArray.join(paramDelimiter)); 
  flashObject.SetVariable("commitFunctionCall", true); 
  } else 
  { //if previous function call is 
  still being run, you can usesetTimeOut etc to call it little 
  later... } 
  }/**###**//script/HEADBODY 
  bgcolor="#FF"!-- look at "flexApp" id/name, thats being 
  used(in JS) to get the referenceof Flash Player in browser. 
  --mm:mxml border="1" id="flexApp" 
  name="flexApp"mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" 
  width="600"height="600" backgroundColor="#FF" 
  mx:Script 
  ![CDATA[ 
  /****/ 
   //the name of the function to be 
  called. var functionName:String; //the params delimited by 
  paramDelimiter var functionParams:String; //param 
  delemiter, kind of unique string  var paramDelimiter = 
  "--$$###$$##$$--";  //setter, which executes the 
  function and send the success flag back to_javascript_ public 
  function set commitFunctionCall(flag:Boolean):Void 
  { var func:Function = 
  this[functionName]; 
   func.apply(this, 
  functionParams.split(paramDelimiter)); 
  getURL("_javascript_:bFunctionCallFinished=true;void(0)"); 
   } 
   
  /****/ 
function 
  sayHi(name:String) 
  { alert("Hi " + 
  name); _ta.text += name + 
  newline; } 
   function setNum() 
  { var n = 
  arguments.length; for(var 
  i=0;in;i++)  
  { 
  _ta.text += arguments[i] + 
  newline; 
  } 
  } 
   

  ]]/mx:Scriptmx:TextArea id="_ta" 
  width="200" 
  height="200"/ 
   
  /mx:Application/mm:mxmlinput type="button" 
  value="Say Hi" 
  /input 
  type="button" value="Send Number"//BODY/HTMLBTW! 
  Based on above principle, I made a JS-Flash libarary long back. Take alook 
  at it for an idea...http://www.abdulqabiz.com/files/JSFC/JSFCommunicator%20Library.htmHope 
  that 
  helps-abdulFrom: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Sent: 
  Thursday, April 28, 2005 9:56 AMTo: flexcoders@yahoogroups.comSubject: 
  [flexcoders] Is there a _javascript_ flashObj.callFunction(), 
  likesetVariable?Using javasript in a custom HTML wrapper, 
  Is there flashObj.callFunction(),like there is a setVariable() 
  method?Or will setVariable() work with a setter method? (Hmm, surely I 
  can create asetter in mxml, 
  right?)TracyYahoo! 
  Groups Links* To visit your group on 
  the web, go to: http://groups.yahoo.com/group/flexcoders/ 
   * To unsubscribe from this group, 
  send an email to: 
  [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] 
* 
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Servicehttp://docs.yahoo.com/info/terms/ 
  . 







Yahoo! Groups Links

RE: [flexcoders] Is there a javascript flashObj.callFunction(), like setVariable?

2005-04-28 Thread Josh Berling
Title: Message





So, 
the browser has a problem with the casing? Are there any more examples of 
this that anyone has found?

  
  -Original Message-From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Matt HornSent: Thursday, April 28, 2005 8:55 AMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Is there a 
  _javascript_ flashObj.callFunction(), like setVariable?
  Just one gotcha to watch out for... Mozilla doesn't 
  recognize getVariable/setVariable. It must be GetVariable/SetVariable (note 
  capital initial letter). IE will allow either one.
  
  matt
  







Yahoo! Groups Links

To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/
To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.










RE: [flexcoders] Is there a javascript flashObj.callFunction(), like setVariable?

2005-04-28 Thread Matt Horn
Title: Message





I dont know anyother specificdifferences 
offhand, but the O'Reilly _javascript_ Definitive Guide is a great place to 
look.

matt

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Josh 
  BerlingSent: Thursday, April 28, 2005 2:42 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Is there a 
  _javascript_ flashObj.callFunction(), like setVariable?
  
  So, 
  the browser has a problem with the casing? Are there any more examples 
  of this that anyone has found?
  

-Original Message-From: 
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf 
Of Matt HornSent: Thursday, April 28, 2005 8:55 
AMTo: flexcoders@yahoogroups.comSubject: RE: 
[flexcoders] Is there a _javascript_ flashObj.callFunction(), like 
setVariable?
Just one gotcha to watch out for... Mozilla doesn't 
recognize getVariable/setVariable. It must be GetVariable/SetVariable (note 
capital initial letter). IE will allow either one.

matt








Yahoo! Groups Links

To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/
To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.