Skip navigation
ryan_se
Currently Being Moderated

How to transfer a local javascript AMF object from webpage to embedded swf file?

Jul 24, 2012 4:38 PM

Tags: #javascript #actionscript3 #amf

Is it possible to transfer AMF data from the containing webpage into the embedded swf file (in that same webpage)?

 

For example, if I have a javascript ArrayBuffer in the webpage, and I encode into an AMF object (yes, this is another issue entirely), is there anyway to pass the AMF object to the swf file loaded in the webpage?

 

Everything I've seen so far is based on getting the AMF from a remote location, using say URLLoader, but in my case I already have the data locally, just not in the swf.

 

thanks

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 25, 2012 7:41 AM   in reply to ryan_se

    use the ExternalInterface class.

     

    if you can use the call() method, you should have no problem.  if you have to use the addCallback() method, you'll need to use compatible (with the ExternalInterface class) embedding code (like swfobject or the sample embed code shown in the flash help files).

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 30, 2012 12:54 PM   in reply to ryan_se

    pass a string instead of a bytearray to test externalinterface.  otherwise, you're testing a lot more than externalinterface.

     

    then you start thinking about your serialization/deserialization code which is where you have a problem.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 30, 2012 11:02 PM   in reply to ryan_se

    what code are you using in your javascript to reconstruct eg1?

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 1, 2012 12:49 AM   in reply to ryan_se

    anything that can be serialized can be passed using externalinterface and amf is serialized.

     

    and it looks to me as if your javascript is receiving the data as an unrecognized data type object.  that's not a problem on the flash end though if you send the object back to flash it will be a problem because you're not registering the class correctly in flash, either.

     

    http://books.google.com/books?id=XJrXl71TITIC&pg=PT487&lpg=PT487&dq=am f+data+externalinterface&source=bl&ots=X12hcBywKg&sig=z1Xkbqyj7mL_Leze Gv4uMYJspjE&hl=en&sa=X&ei=2d0YUKizF-Xq6wGclYEQ&ved=0CFkQ6AEwAg#v=onepa ge&q=amf%20data%20externalinterface&f=false

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points