AS3 Hittest with Illustrator path - actionscript-3

I export a path from Illustrator to an .swf file. I import this file using the Loader class in actionscript 3.
Now I want to perform a collision test on this path in Flash. Is this possible? Now as3 performs this test on the whole bounds of the swf file. I only need the path. Is this possible?

It works good as long you not use any transparacy effects in Illustrator which you want to export, which not are compatible with swf.
There are two settings in ai exporting non compatible effects to swf file.
Appearance: which will make a bitmap under the swf, which make the hittestarea to a square.
Editability: will remake the effects so good as the can to swf, which should possible still keep the polygon hittestarea, but it didnt work for me.

Yes that's possible. BitmapData.hitTest will help you (take a look at e.g. this)

Related

Can a class check if it exists in an SWF or in an FLA?

I have an AS2 component which I need to behave differently in an SWF from an FLA. Can it determine its state programmatically?
Part of the problem here may be too that when I compile it as an SWC it probably doesn't think it's in an FLA anymore.
Since I need to port this to AS3 at some point, I wouldn't mind AS3 solutions too.
Unless wvxvw is correct and you're doing something with live preview, your code always runs as a swf. Swc and fla don't execute anything.
It is possible to get different behavior in different contexts. The easiest way would be to set a flag via swfobject & flashvars (when running in the browser obviously).

How can I export in flash on the fly a MovieClip into a vector file (SVG, EPS)?

I'm trying to build an app allowing the user to arrange different shapes, add text, and export the result as a vector file.
I've been looking into as3swf libraries and especially the SVGShapeExporter class.
It works fine if you load an swf in the app and try to export it on the fly into an svg file but I'd like to work with movieClips instead of loaded swfs.
Since as3swf.SWF objects are based on ByteArrays, I've been trying to get a ByteArray for my MovieClip but it seems to be empty.
Any idea?
Thanks

AS3: Preloader Not Working w/ Exported for AS Graphics

I have a lot of graphics and sounds in my library that are exported for Actionscript in Frame 1. I believe that because of the exported graphics, my preloader will not work. All I get is a white frame while the movie loads.
How can you preload graphics that are exported for Actionscript?
When you export for Actionscript in Frame 1, everything that is exported must be loaded before any content is visible. I usually uncheck this button, and then everything is exported to the first frame where it's referenced. For more details on this approach, check out http://www.developria.com/2010/04/combining-the-timeline-with-oo.html . Howwever, if you're like most developers, you probably reference everything from your main document Class, so this may not do you much good. It does offer the possibility that you can avoid a preloader altogether, though, because loading is spread across different frames.
If your movie is structured like normal, check out http://www.8bitrocket.com/2008/4/22/Tutorial-Preloading-Actionscript-3-AS3-Games-in-Flash-CS3/ .
It is not applicable on every case, but maybe you can preloader in separate file, which loads your main swf.
You can see detailed how to in this tutorial: http://www.gotoandlearn.com/play.php?id=85

Preload sound AS3

I have AS3 project, made with FlashBuilder. I'm using MovieClips from an external .SWC-file.
In a MovieClip from the .SWF-file, I want to use an audio-file.
Is it possible to preload a sound-file (e.g. .MP3) in my FlashBuilder project, and access it in a MovieClip inside the .SWC?
Thanks a lot!
Yes, I don't know hoe you create your swc's but I'll tell you my setup which always works.
I create an asset FLA which would have the mp3 among other things.
I compile using FlashDevelop, and use the preloader template. Never had problems with that.
What you can't do is use SWCs run-time.

Import an .AI file and use some specific shapes from it in AS3

I have in Illustrator a layer with two object named objA, objB.
Is it possible to move objA once the file is loaded in the swf ?
Manipulate some shape from a AI file in AS3.
Thx
-Leg
i understand you want to import graphics during authortime from Illustrator to Flash? if that's your question then yes, but you'll have to place objA and objB on different sublayers before importing to Flash.
importing an Illustrator file onto the stage/library is the same as drawing the objects using Flash, but of course Illustrator is much better for authoring vector graphics than Flash.
each object in your illustration that you want separate should be on it's own sublayer prior to importing them. once they're imported you just simply have to convert them from a drawing object to a symbol and give it an instance name. alternatively, during import, you can convert them to MovieClips and give them an instance name and even set their registration point (see screen shot).
to import your .AI file, simply drag it onto the stage, or select File > Import > Import to stage... or File > Import > Import to library...
also, i believe there is a way to give your illustration layers instance names inside Illustrator, allowing you to set it up for Flash or Flash Catalyst, but how to do that escapes me at the moment.
No.
Illustrator (AI format) has NO means of support over animation or SWF control. It isn't even exported, it is imported - the application being responsible there is Flash, not Illustrator.
You'll have to make it in the actual SWF.