Using Flash as an Advanced Javascript Library ?

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

In recent years Actionscript has given rise to all kinds of spiffy functionality, from some of the best multimedia support on the web, all the way down to being able to work with binary data. It reminds me of 5 years ago when ActiveX controls seemed really cool, but safer and available on multiple platforms.

Javascript, well let's face it, Javascript is pretty lame when it comes to multimedia. Binary data doesn't exist in the Javascript world as far as application developers are concerned.

Both worlds have their strengths. Javascript and HTML together have a huge advantage when it comes to search engines and indexing. Flash blows Javascript out of the water in terms of multimedia and the level of reporting you can give a visitor when communicating with the server. Flash has a huge advantage as far as efficiency is concerned as well.

Now, Flashes ExternalInterface class has provided a fairly stable bridge between Javascript and Actionscript for quite awhile now, I've seen some awesome communication between the two as far as bookmarkable flash scenes and whatnot go, but I've never seen a sort of SWF library movie that's only designed to work as a communication engine between javascript and a server.

Now, images/video would probably be out of the question, but XML data, audio/video controls, file uploads, and things like that could be handled with the SWF and ExternalInterface to get that constant "this is what is going on right now" level of feedback that Flash provides, while retaining all of the benefits of Javascript/HTML.

By now I'm probably rambling on and going off in a dozen different directions, but hopefully I've gotten my point across.
Anyone seen anything like this before ?
Any drawbacks you can think of ?
Any other input ? :)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bozebo
  • Expert
  • Expert
  • User avatar
  • Posts: 709
  • Loc: 404

Post 3+ Months Ago

Ive seen flash used to handle sockets for javascript to communicate with (faster than ajax). Problem is, the browser often tries to handle it in a secure way, ie. only letting it access port 80 on the same hostname. In firefox a message box appears but in IE it just blocks it :( I think I have seen flash uploaders before, cant remember where though.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

The bigger question that I have is why use javascript at all? If your going to use Flash/Flex why not just use it as your entire communication scheme with the DB or backend code?
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

I read this thread yesterday, and I swear to God I had a dream about this in my sleep last night. Except that when I went to bust out Flex Builder to try some things out, I ended up pulling out a board game with the Flex logo on it.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

spork wrote:
I read this thread yesterday, and I swear to God I had a dream about this in my sleep last night. Except that when I went to bust out Flex Builder to try some things out, I ended up pulling out a board game with the Flex logo on it.

lol Flexopoly
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I can't remember where I read it, but someone somewhere mentioned that with Flash player 10 Adobe purposely broke functionality that allowed ExternalInterface to trigger system dialog boxes such as File Choosers.

If that's the case, a huge part of the purpose of this thread is shot.

Anyone know what I'm talking about ? I haven't been able to do much with Flash since about version 8.
I can't imagine why Adobe would do such a thing. :scratchhead:
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

Well AS3/Flash Player 9+ has its own file system interaction setup allowing you to do some things with the host (upload/list files/etc). You just have to use one inside the Flash player as opposed to having the browser do it for you.

Here are a bunch of examples http://www.flex888.com/296/9-flex-file-upload-examples-visited.html

And here's the Adobe docs about the FileReference API

I guess my point is that if your going to use Flash at all why not allow it to do EVERYTHING instead of trying to rely on Flash + Javascript + Browser etc.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

So, did I misunderstand what I read about ExternalInterface not being able to communicate between Flash dialogs like the one triggered for FileReference objects ? :scratchhead:

Quote:
I guess my point is that if your going to use Flash at all why not allow it to do EVERYTHING instead of trying to rely on Flash + Javascript + Browser etc.


Because there's more people who can edit HTML than Flash.
Getting the functionality of Flash with the ease and availability of HTML UI/etc would be a nice selling point for a product.

It would also be a reason for Adobe to sever that connection I guess. Who would want to buy Flash when they could use the free version of Flex to compile a library and communicate with that library via ExternalInterface and JS ?
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

No I don't think you misunderstood about the ExternalInterface. Flash IS blocked from using JS to interact with the file system as a security precaution (Imagine visiting a site where while viewing a Flash Animation your actually getting a virus run on your machine at the same time).

The FileReference is different in that it does all the activity within the Flash player. If you want a file browse dialogue you have to build that dialogue as a movieclip inside of Flash/Flex with a Flash textfield, button, etc.

I have a funny feeling that it IS POSSIBLE to go from JS to Flash and trigger that action inside of Flash where it IS NOT POSSIBLE to have Flash trigger the JS file system actions. This is just my gut assumption since I haven't tested it but from JS to Flash you would simply be calling a function name and it would be pretty hard to block what that function does inside of Flash.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I can definitely understand the filesystem functions themselves being blocked. Blocking access to dialogs had me scratching my head though. I couldn't think of a single security or functionality related reason for that to happen.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

yeah I guess I can't either. Maybe the browser (IE6 I'm looking at you here) somehow can't tell the difference between some types of dialogues/file system requests/etc. But I'm just shooting in the dark here.

Post Information

  • Total Posts in this topic: 11 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.