Question

In Adobe Flash CS6, I'm trying to add a MovieClip from the library to the stage, but not in exported mode (Ctrl + Enter), I want my MovieClip to appear directly on my workspace. That's why I'm trying to use a Flash JavaScript file (.jsfl), which I'm going to run using "Run command..." But I can't figure out how to interact with the stage and library using a Flash Javascript file.

Was it helpful?

Solution

In order to add a MovieClip from the library to the Stage with JSFL you would use:

fl.getDocumentDOM().library.addItemToDocument(position [, namePath]);

The position parameter is the x, y coordinate where you would like to place the symbol on the stage.

The second parameter is a string value that specifies the name of the item in the library. If the item is inside of a folder you can specify the path using slash notation. If you don't include this parameter Flash will default to the currently selected item in the library.

Example: If there is a symbol called "myMovieClip" inside of a folder called "myFolder", and you wanted to place that symbol on the stage at x:250, y:180 the code would be:

fl.getDocumentDOM().library.addItemToDocument({x:250, y:180}, "myFolder/myMovieClip"); 

The documentation for doing this is on this page in case you want more information:

Extending Flash

Hope that helps out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top