Source language: Translate to:

Calling Flash ActionScript Functions

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Calling Flash ActionScript Functions

Postby luishp » Sun Nov 25, 2007 5:15 am

Since Flash Player 8, an ExternalInterface object is implemented in ActionScripit to allow host applications (web-browsers, NeoBook...) to call ActionScripts functions.

I'm unsure but i think it's not currently possible to do such thing from NeoBook allthough it's very easy from JavaScript.

In case it was possible a new world of posibilities should be open to NeoBook, as i think new "plugins" could be created from Flash.

Any information about it?
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby Neosoft Support » Mon Nov 26, 2007 11:59 am

That's an interesting idea. NeoBook currently supports Flash's fsCommand feature which allows NeoBook commands to be called from within a Flash file, but we have not looked into doing the opposite with ExternalInterface yet. I will add this post to the list of things to consider for future updates.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Mon Nov 26, 2007 2:12 pm

luishp:
I'm unsure but i think it's not currently possible to do such thing from NeoBook allthough it's very easy from JavaScript.
Although a direct bridge (NeoBook to Flash functions/routines) would be most desirable ... in the mean time, the same end result can be achieved by using the Browser object as an intermediary i.e. run the flash via an html document that is run inside a Browser object.

So you could have a dummy (shell) html document with Javascript functions that interact with the Flash file running in the <object>...</object> tags ... and have NeoBook commands that "invoke" these Javascript functions when required.

Also, while NeoBook's ability to "invoke" existing Javascript functions is well known and proven ... I also recall testing the ability to dynamically add Javascript functions to an html document running in the Browser object ... and then invoking it with appropriate parameters ... so the shell document would not have to be pre-populated with all required Javascript functions.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby eddy current » Mon Nov 26, 2007 2:40 pm

This is a VERY interesting thread! Many of us would like to see the direct bridge between Flash and NeoBook, and this method has some merit.

But in the meantime, the dynamic Javascript suggestion from Gaev is priceless. You could have a database of such "mergeable" routines that you could build on the fly. Hmmm....food for thought.

Glen
eddy current
 
Posts: 48
Joined: Mon May 23, 2005 7:24 pm

Postby luishp » Tue Nov 27, 2007 5:48 am

Thanks everyone for your interest in this issue.

Gaev i know the bridge method using javascript and i think it's fine and it works, but it's time consuming and forces to prepare every flash movie to work properly with appropiate NBScripts and JavaScripts routines.

Some time ago i released an ActionScript and an Aflax interpreters for NeoBook with no great success probably due to their complexity.

I think Neosoftware could release a minor update with this posibility enabled (calling directlly an AS function), so we, the ActionScript developers could distribute our SWF files with a list of available functions and the appropiate description... nothing more. Simple and usefull.

In my humble opinion that would be really great, as NB graphic and programming capabilities would be terribly incrised.
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby Gaev » Tue Nov 27, 2007 6:29 am

luishp:
Gaev i know the bridge method using javascript and i think it's fine and it works, but it's time consuming and forces to prepare every flash movie to work properly with appropiate NBScripts and JavaScripts routines.

Some time ago i released an ActionScript and an Aflax interpreters for NeoBook with no great success probably due to their complexity.
Your samples a few months ago were impressive ... in that they illustrated "a proof of concept" regarding the bridging of the two technology components.

The lack of interest was probably due to a lack of simplicity in the NeoBook commands within the examples ... as I had mentioned to you then, this could be addressed with the use of NeoBook Functions ... which is like creating your own custom NeoBook (macro) commands.

I trust that the most implementations of this new facility in the Flash Player are currently via Javascript in html documents that also host the swf file ... so, if a (generic) bridge was built from NeoBook to such Javascript, it would instantly open up access to a whole new world of flash rendering.

If you want to try a joint project, perhaps you can prepare a flash file with some of your Action Script Functions ... and document how they would be called from a Javascript function ... and I will prepare a matching NeoBook Function ... so NeoBook developers can exploit your flash facilities with just a single Call command from within NeoBook ... let me know if you are interested.
I think Neosoftware could release a minor update with this posibility enabled (calling directlly an AS function), so we, the ActionScript developers could distribute our SWF files with a list of available functions and the appropiate description... nothing more. Simple and usefull.

In my humble opinion that would be really great, as NB graphic and programming capabilities would be terribly incrised.
I would like nothing more than a direct interface like this ... but unless Dave agrees to drop current planned projects, the probability of this happening soon would be low ... perhaps some "proof of concept" with the proposed double bridge ... might help make the implementation of the direct interface sooner.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby luishp » Tue Nov 27, 2007 6:45 am

Ok Gaev, let's try it.

Take a look at this:

http://www.hdezpena.com/archivos/easing/moving.html

And the ziped version:

http://www.hdezpena.com/archivos/easing/moving.zip

It implements easing movements to any picture loaded.
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby Neosoft Support » Tue Nov 27, 2007 11:20 am

Thanks for the example. I will look into it.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Tue Nov 27, 2007 1:49 pm

luishp:

Got the first button working ... will work on the rest tonight ... let me know ... via PM on this forum ... where you want me to email the .zip with demo pub, function files and modified html file.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Gaev » Tue Nov 27, 2007 3:28 pm

luishp:

All done !!! ... 3 functions that you can Call from NeoBook ... e.g. ...
Code: Select all
Call "lhp\lhpLoadImage" "WebBrowser1" "moving" "image.png"
Call "lhp\lhpMove" "WebBrowser1" "moving" "200" "200" "4" "easeOutElastic"
Call "lhp\lhpRotate" "WebBrowser1" "moving" "90" "2" "easeOutQuad"

... each function invokes a (predefined) Javascript function ... the Javascript function invokes the same (dhtml-like) command that your button was invoking via the "onClick" function.

Let me know your email address.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby luishp » Wed Nov 28, 2007 7:24 am

I've done a more complex example on neobook with JavaScript.
This is just the tip of the iceberg about what can be done...

http://www.hdezpena.com/archivos/moving/powerflash.zip

I'm still waiting for Gaev to send me his work. :D
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby Gaev » Wed Nov 28, 2007 7:44 am

I'm still waiting for Gaev to send me his work.
... I sent you an email ... 16 minutes before you posted your message ... remember I live in Toronto ... so I wake up six or seven hours after you do :) ... and that was when I got your email address.

Let me know (here on the forum) if you didn't receive it in a half hour.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby luishp » Wed Nov 28, 2007 8:45 am

I've got it Gaev. Thank you very much.
We have been thinking very similar things. Please see my email and last demo posted within this thread.
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby HPW » Wed Nov 28, 2007 8:47 am

Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby HPW » Wed Nov 28, 2007 8:53 am

And the file image.png is missing in the zip.
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Next

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest