Javascript :: Returning A Byte String To ExternalInterface.call Throws An Error?

Jan 21, 2010

I am working on my open source project Downloadify, and up until now it simply handles returning Strings in response to ExternalInterface.call commands.

I am trying to put together a test case using JSZip and Downloadify together, the end result being that a Zip file is created dynamically in the browser, then saved to the disk using FileReference.save. However, this is my problem:

The JSZip library can return either a base64 encoded string of the Zip, or the raw byte string. The problem is, if I return that byte string in response to the ExternalInterface.call command, I get this error:

Error #1085: The element type "string" must be terminated by the matching end-tag "</string>"

ActionScript 3:

var theData:* = ExternalInterface.call('Downloadify.getTextForSave',queue_name);

Where queue_name is just a string used to identify the correct instance in JS.

JavaScript:

var zip = new JSZip();
zip.add("test.txt", "Hello world!
");
var content = zip.generate(true);
return content;

If I instead return a normal string instead of the byte string, the call works correctly.I would like to avoid using base64 as I would have to include a base64 decoder in my swf which will increase its size.

Finally: I am not looking for a AS3 Zip generator. It is imperative to my project to have that part run in JavaScript

View 2 Replies


Similar Posts:


Javascript :: Returning A Variable From An ExternalInterface.call Back Into Flash

Feb 17, 2010

I'm calling a JS function with ExternalInterface.call and trying to get a return value inside Flash. When I trace out the op variable I get 0 instead of 500. Is there something wrong with my embed code?[code]

View 4 Replies

Javascript :: Reference The Html Object That Made The Call To SomeFunction Directly Using The ExternalInterface.call Call?

Jun 28, 2011

i have some actionscript that makes a

ExternalInterface.call('someFunction');

call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?

Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.

Currently:

Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);

[code]....

View 1 Replies

Actionscript 3.0 :: Remoting Call Throws Code=NetConnection.Call.BadVersion Error

Sep 27, 2009

I'm trying to get the AS3 Flash remoting example found here: [URL]. and I keep getting this error: Code: Select allError #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion at amfphp1_fla::MainTimeline/frame1() Here's the code I'm trying:

[Code]....

View 1 Replies

ActionScript 3.0 :: Use ExternalInterface.Call To Call A JavaScript Function To Launch A Lightbox Window?

Jun 22, 2009

I'm trying to use ExternalInterface.Call to call a JavaScript function to launch a lightbox window. So far I have this:

AS3:
flash.external.ExternalInterface.call("launchLB", "" + aUrl + "");
JavaScript:
function launchLB(url) {
alert(url);

[Code]....

I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.

View 1 Replies

Flash - Externalinterface.call Won't Call The JavaScript Function - Firefox 3.6

Feb 10, 2011

I have a function defined in JavaScript like so:

function fadeBack() {
alert("fadeBack called");
};

I call that function from my Flash file like so:

import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");

This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?

View 2 Replies

ActionScript 3.0 :: Call Javascript With ExternalInterface.call

Sep 29, 2008

I'm trying to call a javascript function from a flash movie. I'm using IE.

This one works:
AS3: ExternalInterface.call("test();");
Javascript:
function test()

[Code].....

...it says "undefined" insted of alert(666)...it seems that if i use a field in the function it simply stops working. (I'm accessing the page [URL]

View 2 Replies

Flex :: Application Throws Error When Making Http Call (GET Request)?

Jun 13, 2011

I get following error occasionally while running my flex application. I dont know what is wrong as it works intermittently.

Error occured (mx.messaging.messages::ErrorMessage)#0
body = ""
clientId = "DirectHTTPChannel0"

[code].....

View 1 Replies

JavaScript :: Unable To Get ExternalInterface.Call To Work In IE7

Aug 11, 2010

<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script language="javascript" >
swfobject.registerObject("myId", "10.0.0");
function execute(){
return a;
}
[Code] .....

I have this which is based off of this question: [URL]. However this neither works in firefox and IE. If I embed my flash into the browser like this:
<embed src="helpdeskApp_three.swf" id="flash" quality="high" scale="exactfit" width="800" height="500" name="movie" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="[URL]"/>

This works in Firefox but not IE. What is the proper way of embedding my flash movie so it works across all browsers?

View 1 Replies

Javascript :: ExternalInterface Call From Flash To Function In OOP?

Dec 7, 2010

I can't call a javascript function from flash, when the flash object is added within an OOP structure in javascript. In short the code:

In flash:

if (ExternalInterface.available) {
ExternalInterface.call("flashMessages", "ready");
}

[Code]....

Flash gets loaded, but the call to the javascript function isn't received.

View 1 Replies

Javascript :: ExternalInterface Call Crashes The Browser?

Jan 20, 2011

In Actionscript 3, I make a call to Javascript using:

ExternalInterface.call('javascriptFunction');

If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?

[Code]...

I'm on an HP desktop with Windows 7, Firefox 5.0, IE9, and Chrome 12.0.742.122. Either alert call will randomly cause Firefox to freeze...it actually usually happens in bunches, where it'll freeze for a few times continuously (obviously restarting Firefox each time)..and then stop for a few hours and be alright.It has yet to crash IE9 or Chrome, though I haven't tested it as extensively with Chrome. Using the Firefox console doesn't help since Firefox just crashes all together. If anyone could shed some light on that, that'd be great!

View 2 Replies

Javascript :: Call A Function Using The ExternalInterface.addCallback API ?

Jun 1, 2011

I'm trying to call a function in an action script using the ExternalInterface.addCallback API, but I can't seem to get it to work. Here's what I have:

ActionScript:

//MyClass.as
package {
import flash.display.Sprite;[code]....

The Error I'm getting is: Uncaught TypeError: Object #<HTMLObjectElement> has no method 'getStringJS'

I also tried adding in a timeout in case the swf file wasn't loading, but I didn't have any success with that method either.

View 2 Replies

Javascript :: Determine Which Movie An ExternalInterface.call Came From?

Sep 15, 2011

On my page, I'm going to embed multiple Flash files that use ExternalInterface to communicate back to the page. When the page receives the ExternalInterface calls, is there any built-in way to determine which swf the call came from?

I don't mind giving each movie a guid FlashVar and attaching that to each ExternalInterface call, but I don't want to duplicate more tested functionality.

View 1 Replies

ActionScript 2.0 :: ExternalInterface.call Remote/outside Javascript?

Jul 11, 2008

I'm trying to use ExternalInterface.call() to access a function from an outside domain that I have linked in my html page. Is there anyway to do this?

Code:
<script type="text/javascript">
var flashvars = {};

[code]......

View 3 Replies

ActionScript 3.0 :: ExternalInterface To Call JavaScript Function On Other Domain

Sep 15, 2011

using ExternalInterface to call JavaSript function on other html site. (because most of the examples show only how to use it within the same domain).

View 1 Replies

Javascript :: As3 ExternalInterface.call Causing Browser Crash

Sep 14, 2011

I've written an html page that is using some javascript to hide and display a flash movie object. It all works fine until I try to exit from the tab, and when that happens the entire browser will crash with not so much as an error text box.

Flash Code

if(ExternalInterface.available)
ExternalInterface.call('hideTimeline');

Javascript code

function showTimelineFirstPlay()
{
var timeline = document.createElement('span');

[Code].....

View 1 Replies

ActionScript 3.0 :: Add An ExternalInterface.addCallback To Get A String Back From A Javascript?

Jun 22, 2009

I'm trying to add an ExternalInterface.addCallback, to get a string back from a javascript function so that I can set the "visible" property of movie clip "title" to "true." Can someone tell me what I'm doing wrong?Here's my AS code:

[Code]...

View 3 Replies

Javascript :: Pass A Reference To A Function As An Argument To An ExternalInterface Call?

Mar 26, 2010

I want to be able to call a JavaScript function from a Flex app using ExternalInterface and pass a reference to a different JavaScript function as an argument.

[Code]....

View 1 Replies

Actionscript 3.0 :: Make A Public Static Method Call Another Method, But Flash Throws Error 1180?

Feb 19, 2010

I'm tryng to make a public static method call another method, but Flash throws error 1180, sayng that the method called by the static method is undefined.

Code: Select allpackage
{
import flash.display.MovieClip;[code]....

View 2 Replies

Flex :: Throws A Warning,unlike Java, Which Throws An Error "Assignment In Conditionals"?

Aug 6, 2009

If I use an Assignment within conditional, for e.g.
if(userType='admin')

Flex throws a warning,unlike Java, which throws an error.Why should Flex be doing this, despite being one of the newest languages? 1100: Assignment within conditional. Did you mean == instead of =?

View 2 Replies

Javascript :: Error Accessing Class Variables Within An ExternalInterface Callback

Aug 28, 2011

Here's my actionscript (compiled with mxmlc, embedded into html, and the functions are called with js):

[Code]...

View 1 Replies

Javascript :: Run In Flex Mobile Project - Error #2067: The ExternalInterface Is Not Available In This Container

Dec 21, 2011

From what Ive seen, most of the examples of using Javascript in Flex are designed for for the full desktop version (or for the browser) and not Flex mobile. For example using ExternalInterface in a Flex mobile project gives the error: Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime. Is it possible to call Javascript (such as the Google Maps Javascript API) in a Flex mobile project?

View 1 Replies

Java :: "Invalid Byte 1 Of 1-byte UTF-8 Sequence"error?

May 25, 2010

Invalid byte 1 of 1-byte UTF-8 sequencemy error is the above line.am using am calling java method using Blaze DS.

View 3 Replies

Flash :: Call Anonymous Function From ExternalInterface.call() Method?

Nov 4, 2010

I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.

Can this be done? I am trying to use the ExternalInterface.call()

AS:

ExternalInterface.call("function(){return window.someVar}", null);

JS:

var someVar = "Test";

This does not work and I suspect it is because the ExternalInterface.call() does not like the anonymous function.

View 2 Replies

Flash :: Replace A URLLoader Call With ExternalInterface Call?

Feb 10, 2011

We have been given some code that does a URLRequest call which is really slow to respond, so I was looking to make it pull the data from the page, as it is already on the page.[code]I have tried to replace it with this (actionscript is definitely not my forte):[code]I am using addCallBack as that is what the editor suggested via autocomplete, unfortunately it doesn't seem to work. Unfortunately I cannot go back to the developer at this time.The error message is:Call to a possibly undefined method addCallback through a reference with static type flash.external:ExternalInterface

View 3 Replies

Actionscript 3 :: Get The Byte Length Of A String?

Sep 4, 2010

Is there an easy way to get the byte length of a string in AS3? String.length works in many cases, but breaks if it encounters mulibyte unicode characters.(in this particular case, I need to know this so I can preface messages sent across a TCP socket with the message length. This is in standard netstring format e.g. "length:message,").

View 1 Replies

ActionScript :: Passing An JPG Byte Array To Javascript And Eventually To PHP

May 18, 2010

Our web application has a feature which uses Flash (AS3) to take photos using the user's web cam, then passes the resulting byte array to PHP where it is reconstructed and saved on the server. However, we need to be able to take this web application offline, and we have chosen Gears to do so. The user takes the app offline, performs his tasks, then when he's reconnected to the server, we "sync" the data back with our central database.

We don't have PHP to interact with Flash anymore, but we still need to allow users to take and save photos. We don't know how to save a JPG that Flash creates in a local database. Our hope was that we could save the byte array, a serialized string, or somehow actually persist the object itself, then pass it back to either PHP or Flash (and then PHP) to recreate the JPG. We have tried:

[Code]...

View 1 Replies

Flex :: Place Images Byte Into String Is Not Working?

May 10, 2010

I tried on Flex 3, facing issue with uploading JPG/PNG image, trace readUTFBytes would return correct bytes length but tmpFileContent is trucated, it would only appear to have upload just 3 characters of data to the server through PHP script which made image unusable.I have no issue for non-images format. What is wrong here?

View 3 Replies

Javascript :: Feed Video Byte Data To Flash Player?

Jan 21, 2012

Is it possible to, using javascript, either create video data on the fly, or more likely download pieces of video data from various sources and feed them to a flash player instance.

Even better, is it possible to feed a html5 video stream from locally executed javascript?

View 1 Replies

Actionscript 3 :: Reading A Byte Array Into An Object After Being Decoded From A String?

Jul 29, 2011

I'm trying to serialize and deserialize a byte array to a string using Base64 for as3.

Here is my code

public function Serialize(vector:Vector.<Action>):String
{
var bytes:ByteArray = new ByteArray();
var serialized:String = "";

[Code].....

is the error I get after calling deserializedObj = deserialized.readObject(); Should I be get that error if I'm just trying to put this into an object? I'm not trying to put it into an action class object yet, but if it is then the action it's getting doesn't have parameters that were originally inside.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved