0

I'm looking to create a tool that places objects on the stage based on variables that the user specifies on an app that i created in the form of an swfpanel.

I'm stuck, i cant seem to be able to get the two items to communicate with each other.

Any help ya'll can provide is greatly appreciated.

CLARIFICATION: By "tool" i mean a custom JSFL tool that is located in the tools panel.

It has an accompanying WindowSWF panel. When certain settings are tweaked, this tool would use whatever the settings the user has selected in the way it behaves. So what im looking for is a wa to make the custom tool in the tools panel cummunicate with the custom WindowSWF panel.

1 Answers1

0

I have a tool that does something along the lines of what you are asking about. In my tool, the user clicks a button that has a predefined variable, in this case, a TV guide for animation, but it could be made dynamic so that the user decides what the button inputs by using a list or a text input. The button then executes a script that I have below that imports a SWF from my content library and places it on the stage. This content doesn't necessarily need to be from an external file. It could be from the Flash library as well.

This example is single purpose and hard coded to be used for a specific item, but like I mentioned you could create a list in your SWF panel and depending on what item is selected in that list, you pass in that variable as a string to the JSFL script. I generally place all of the JSFL inside the ActionScript class when I do this and use MMExecute to execute the JSFL. The reason I do this is so that it is easier to read and I can see where I am passing in these variables.

var dom = fl.getDocumentDOM();

if (dom == null)
{
    alert('Please open a file.');
}
else
{
    var lib = dom.library;
    var file = fl.configURI + 'WindowSWF/ContentLibrary/TVGuide.swf';

    // Create a new layer and name it TV Guide
    dom.getTimeline().currentLayer = 0;
    dom.getTimeline().addNewLayer('TVGuide');

    //dom.getTimeline().setLayerProperty('name', 'TVGuide');

    // Import the TVGuide SWF
    dom.importSWF(file);

    //Lock the TVGuide Layer
    dom.getTimeline().setLayerProperty('locked', true);
}
andrewdoll
  • 146
  • 5
  • not sure if that works. Don't undertand how that communicates between the swf panel and the tool in tools panel. I can see how this would import that swf file, but what method is used to tell the tool what variable to load from the swf panel? Im currently thinking maybe the only way is to have the swf panel continually write a text file that maybe the jsfl tool can load and read from, I dont know. – Ibis Fernandez Mar 17 '14 at 17:57
  • Ah thank you for the clarification Ibis. That is quite different than what I had originally imagined. I have only tried out making a tool that lives in the tool panel once. That is still a pretty big mystery to me because there isn't a lot of documentation for that area. I will look into that some more and see if I can figure anything out. – andrewdoll Mar 20 '14 at 03:59