Calling methods / setting vars from APP to Flex Flash Problems(Read 12884 times)
Hi there,

I am evaluating the Flash in App from your website (downloaded it two days ago) and have stumbled upon some issues (Snow Leopard, base SDK: 10.5)

I can successfully load a flash movie but i seem to be unable to communicate to it properly - from the application.

I am using a test Flex (Flash 9) created flash movie, basically what i am doing is:

if([[moviePath pathExtension] isEqualToString:@"flv"])
   {
      isLoaded = [flashView loadFlvAtPath:moviePath];
   }
   else
   {
      NSURL * url = [NSURL fileURLWithPath:moviePath];
      NSURL * baseURL = [NSURL fileURLWithPath:[moviePath stringByDeletingLastPathComponent]];
      isLoaded = [flashView loadMovie:[NSData dataWithContentsOfURL:url] atURL:url withBaseURL:baseURL];
   }
   
   [flashView play];
   [flashView gotoFrame:0];
   
        [flashView setVariable:@"ownd" toValue:@"xxx-yyy-xxxx"];

        [flashView invokeFunction:@"testCallToFlex" withArgument:@"ONE STRING"];

Neither the variable is being set, nor the function is being called.

Two strange things - after i setVariable() and try to getVariable() - i see the new string being set - but not on the view itself...
The other one is when i test if the method is valid and callable from your methods - it returns NO.

The same code - with your test provided flash movies: flash1.swf in demo 1 - works perfectly fine....

I checked for differences in the flash files - nothing really that different...

Here is the Flex part:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="appInit();" >

<mx:Script>
 <![CDATA[
 import mx.controls.Alert;
 import flash.external.*;
  
 [Bindable] public var ownd:String = "";
 public var callCount:int = 0;
  
 private function appInit():void
 {
  if (ExternalInterface.available)
  {
         ExternalInterface.addCallback("testCallToFlex", testCallToFlex);        
        
  }
 }

 
 private function testCallToFlex(msg:String):void
 {
  status.text = "Call Received: " + callCount + " Msg: " + msg + "\n" + status.text;
  ++callCount;
 }

  
 ]]>
 
</mx:Script>

<mx:TextArea id="status" width="300" height="200" text="{ownd + Application.application.parameters.ownd}"/>
 
</mx:Application>
[3/2/10 6:46:55 PM] Компютри Втора Употреба: <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="appInit();" >

<mx:Script>
 <![CDATA[
 import mx.controls.Alert;
 import flash.external.*;
  
 [Bindable] public var ownd:String = "";
 public var callCount:int = 0;
  
 private function appInit():void
 {
  if (ExternalInterface.available)
  {
         ExternalInterface.addCallback("testCallToFlex", testCallToFlex);        
        
  }
 }

 
 private function testCallToFlex(msg:String):void
 {
  status.text = "Call Received: " + callCount + " Msg: " + msg + "\n" + status.text;
  ++callCount;
 }

  
 ]]>
 
</mx:Script>

<mx:TextArea id="status" width="300" height="200" text="{ownd + Application.application.parameters.ownd}"/>
 
</mx:Application>


I need this .. urgently :) have to make sure it all works then i'll proceed to the buying (company license)

Thanks!
Martin Kovachev,
Nimasystems Ltd



We are not able to give you an explanation without further details.

Please, write to us at support_AT_eltima.com and provide us with the Flex project and SWF movie so that we may investigate the issue.



 

Sitemap 1 2 3 4 5