Click on any phrase to play the video from that point.
[CS6]
Using the toolkit for Create JS extension in Flash Professional CS6
allows me to create HTML content from Flash Professional, which is really cool.
But what you can also do in your Flash file is you can actually write JavaScript--okay?--
and then output that as well as HTML.
Very cool that you're able to do this
and that's what I'm going to add to this file.
Just scrubbing through it, it's pretty straightforward animation,
but right down here at the end is where I want to add some JavaScript.
So currently, there's just a simple stop action.
But just below that, I want to write some JavaScript.
And how you do that is actually in comments.
So I'd go ahead and add, say, a multiline comment
or you can add a single line comment, either way.
The important thing is you have to do a space JS in lower case
that identifies this block of code as JavaScript
and it will execute.
So right in here, I can just do a simple alert.
So we'll do alert("Hello JavaScript!");
Keeping it simple, I can put pretty much anything I want in here,
but I want an alert box to pop up when this animation basically reaches the center.
So that's all I need to do, I'll go ahead and save this file
using my toolkit for Create JS I can go ahead and export this out.
Notice that there is help available as well
so I encourage you to check that out.
But, what I'm going to do is click export.
Here's my HTML content, my character floats up, and there's my alert box.
So, pretty straightforward, that's just one simple example.
Just, you need to make sure it's in a comment, and you have JS in lower case there
and you can write all the JavaScript that you want.
But you can go beyond that, this is just a simple example.
In fact, what I have here is something that's a little more complex
which is just going to enable me to have this character follow the mouse cursor.
And this is, again, written in this comment, just like that.
It's going to follow the mouse position.
And we can go ahead and see this in action if I just click export.
Here's the HTML, and there's the JavaScript working
you can see this character follow the mouse.
So this works out great.
You, as a Flash developer or designer, can now write JavaScript
in a program you are familiar with
and then output that HTML and actually see it working.
It's awesome you're able to hit more platforms and even more devices this way.
[ADOBE® TV] [tv.adobe.com]
