Extending Flash API

18 views
Skip to first unread message

goliatone

unread,
Nov 25, 2011, 8:15:39 AM11/25/11
to Jangaroo Users
Hi,
I have been looking into porting some flash experiments with Jangaroo.
One limitation I keep bumping into is that the filter support in nill
atm.
I thought to give it a try and start implementing the BlurFilter.
Leaving aside the build process and focusing only on the actual code,
what would be the work-flow like?
I looked into the current flash API implementation on github, focusing
on the display package.
Based on this, and using the Graphics.as as a reference, I gather that
you have an actionscript light implementation that relies on a private
level with the actual specific workload, which would be analog to the
internals of the flash player.
This private implementation is what deals with the javascript
specifics, the jangaroo part, that deals with things like
HTMLCanvasElement's and CanvasRenderingContext2D's. So, the actual
implementation.

I'm assuming that if I define public methods there, they will not be
accessible from flash application compiled with jangaroo, right?

Let´s say that I have a javascript implementation of the filter. How I
would go about to actually integrate it with the flash API?

I'm thinking in terms of method scoping, for instance.
In the DisplayObject class, the set filters method gets an Array of
BitmapFilters.
We have to update the instance's visual appearance.
We would rely that implementation to the jangaroo part. The idea would
be to have each concrete filter have it's own jangaroo implementation
relaying on the browser and BitmapFilter define, say, an applyFilter
method which has to be accessible from our rendering loop in the
DisplayObject.

What would be the advice here?

Frank

unread,
Nov 28, 2011, 3:21:59 AM11/28/11
to Jangaroo Users
Always remember that when we use Jangaroo, coding in AS3 means
targeting JavaScript. Thus, you'd implement the Flash API in AS3 and
use the "native" browser APIs (from jangaroo-browser), e.g.
CanvasRenderingContext2D, to simulate FlashPlayer's behavior. So if
you had a JavaScript implementation of the filter, you could "fill" it
into the methods of the corresponding class in JooFlash, as JavaScript
code *is* ActionScript code. You can also add private methods and
fields as needed. You could then continue adding type information to
end up with "greener" code in your IDE. Compile, and the JooFlash
runtime is a little better.
Does that answer your question, or am I missing your point?
Reply all
Reply to author
Forward
0 new messages