FancyUpload 2.0 - problem returning values from JS methods to Flash in IE after ExternalInterface.call()

21 views
Skip to first unread message

temuri

unread,
Nov 11, 2008, 8:34:03 PM11/11/08
to ActionScript User Interface Development
Hi all,

Sorry if this looks like an off-topic message.

I've been trying to customize FancyUpload to pass extra data via POST
with every upload (file title and description fields).

Everything works fine in FF, but in IE6 & 7 POST is not sent to the
server.

After many hours of debugging I discovered, that the problem lies in
this method:

onBeforeOpen: function(file, options) {
this.log('Initialize upload for "{name}".', file);
var fn = this.options.fileUpload;
var obj = (fn) ? fn.call(this, this.getFile(file),
options) : options;
return obj;
},

`obj` contains additional data for POST - title and description. It
is
not received by Flash caller in IE, thus it's not sent to the server.
It appears that IE occasionally has problems with
ExternalInterface.call() calls and loses values returned by
Javascript
functions.

I found a link on the web that describes similar behaviour:
http://scott.harwell.me/?p=108. There the author claims that <embed /
>
tags should be used. However, Swiff only uses <object /> tag. Could
this be a problem?

There is another place in FancyUpload code that creates problem with
a
similar symptoms.

Open the following in IE: http://digitarald.de/project/fancyupload/2-0/showcase/photoqueue-fixed/

Check"Images only" checkbox, click "Browse File" link. You will see
that filter was not applied and file mask is set to *.* (in FF you
are
going to see image file extensions).

In this case, the problem lies in:

initialize: function(options){
....
if (!callBacks.onBrowse) {
callBacks.onBrowse = function() {
return this.options.typeFilter;
}
}
}

See "return this.options.typeFilter;" there? Well, that's exactly
what
does not go back to Flash in IE.

I have Flash 10 and I've tested this in Flash 9 as well. IE gets it
all wrong on both cases.

The problem looks quite serious, this essentially renders external
interface calls unusable.

Any help offered will be greatly appreciated.

Thanks,
Temuri

Skitsanos

unread,
Nov 12, 2008, 8:51:57 AM11/12/08
to ActionScript User Interface Development
Temuri, let's put it this way, you have 2 options, one is to use
ActiveContent lib from adobe and second one is to use SWFObject, that
i consider more flexible. From tons of apps deployed and using
ExternalInterface i never had any problems, maybe because i run it
under SWFObjects, i don't know... Try to make it same way and see if
problem still exists.

Cheers,
Evi.

gencha

unread,
Nov 20, 2008, 8:51:19 AM11/20/08
to as...@googlegroups.com
I was just very confused when I noticed that JTextField and
JTextComponet don't dispatch any InteractiveEvent.TEXT_CHANGED events.
I guess one can use flash.events.TextEvent.TEXT_INPUT, but if there is
an AsWing event that fits, why not use it?
So I added it to the bottom of JTextComponent.__onTextComponentTextInput.
Sadly in appropriate event listeners, if you call getText() on the
dispatching JTextField, you won't receive the current text, but the one
from before the edit.
So, for myself i use:
AsWingManager.callNextFrame( function():void { dispatchEvent( new
InteractiveEvent( InteractiveEvent.TEXT_CHANGED ) ) } );

I'd love to hear your thoughts ;)

gencha

unread,
Nov 20, 2008, 9:00:08 AM11/20/08
to as...@googlegroups.com

As so often I posted too quickly ;)
The correct way to solve this would be:
public function JTextComponent(){
..
textField.addEventListener( Event.CHANGE, __onTextComponentTextChanged );
}
private function __onTextComponentTextChanged( e:Event ):void {
dispatchEvent( new InteractiveEvent( InteractiveEvent.TEXT_CHANGED ) );
}


That seems to work a lot better

Evgenios Skitsanos

unread,
Nov 20, 2008, 7:08:56 PM11/20/08
to as...@googlegroups.com
at least it nice to hear from you, dude ;)

gencha

unread,
Nov 20, 2008, 9:04:06 PM11/20/08
to as...@googlegroups.com
Evgenios Skitsanos wrote:
> at least it nice to hear from you, dude ;)
Heheh, I can only give that back ;)

Evgenios Skitsanos

unread,
Nov 21, 2008, 5:53:26 AM11/21/08
to as...@googlegroups.com
what u r up to these days man? did somth cool again?

I'm pushing here Pascal to open source his SPAS framework (http://www.flashapi.org/) kind of big alternative to aswing. i didn't had yet my hands on it, but sounds very promising.

gencha

unread,
Nov 21, 2008, 7:10:30 AM11/21/08
to as...@googlegroups.com
Evgenios Skitsanos wrote:
> what u r up to these days man? did somth cool again?
Subscribe to my feed and you shall know ;D
I just entered the AS3 25lines contest. But I'm not gonna spoil any
surprises ;D
>
> I'm pushing here Pascal to open source his SPAS framework
> (http://www.flashapi.org/) kind of big alternative to aswing. i didn't
> had yet my hands on it, but sounds very promising.
Interesting but I don't see myself replacing AsWing with it any time soon ;)
>
> >

Evgenios Skitsanos

unread,
Nov 21, 2008, 3:39:55 PM11/21/08
to as...@googlegroups.com
bring your feed man, ;)

--
evi skitsanos | http://twitter.com/skitsanos

gencha

unread,
Nov 21, 2008, 4:57:28 PM11/21/08
to as...@googlegroups.com

Evgenios Skitsanos

unread,
Nov 21, 2008, 5:23:41 PM11/21/08
to as...@googlegroups.com
as always you have tons of nice thigns man, i like your Supernova implementation (http://www.dirty-motherfucker.org/blog/2008/08/18/supernova/)

Evgenios Skitsanos

unread,
Nov 21, 2008, 5:27:43 PM11/21/08
to as...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages