Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

flash - CS5.5 import video through jsfl without video wizard

I'm trying to have a jsfl script import a video into my .fla project and export the entire thing as a .swf automatically Is it possible to disable the video wizard when importing videos? I'd hate to have to manually confirm all the options every single time. The video is in .flv format if that makes any difference

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

AFAIK you can't bypass the FLV import dialog directly (using the JSFL API).

I've tried automating the FLV import wizard using a Sikuli script. The script can be run from JSFL using the undocumented FLfile.runCommandLine().

I'm using OSX so I'm not sure if this next part applies for Windows too. If I run the sikuli + the script directly:

FLfile.runCommandLine("/Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");

Flash will wait for this to run then continue importing the FLV which is a problem. The Sikuli script will timeout since the Import FLV dialog will never appear.

Still, I can run this:

FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");

And this seems to open a window of the application and runs the script asynchronously, which is great. Then I run the import. The sikuli script:

  1. waits for the faded out(out of focus) dialog
  2. clicks to get focus
  3. clicks the Embed FLV in SWF and play in timeline option
  4. waits for the dialog with the proper option selected
  5. clicks Continue
  6. waits for the next screen
  7. clicks Continue
  8. waits for the next screen
  9. clicks Finish

Also, on my machine, the script always worked when I had SikuliIDE open (with no particular script) and minimized.

The full test script to import a video looks like this:

var doc = fl.getDocumentDOM();
FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");
var path = FLfile.platformPathToURI('Users/george/Desktop/cuePointTest_1.flv');
doc.importFile(path);

You can find a recording of the script running here. After I run the JSFL script, the rest of the clicks are handled by Sikuli. You can also download the source script and the Sikuli executable script for my setup, but I imagine it will be different on yours. Sikuli is easy to use: type a command, go to your app and press CMD/Ctrl + Shift + 2 to grab a snapshot and continue.

If this does the job for your, then you can probably modify the sikuli script to wait for some time to do the clicks for the next video in the sequence, while Flash loads a new document. There should be other workarounds to manage a list of videos, but that makes sense if this solution works for your setup.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...