| java.lang.Object org.openlaszlo.iv.flash.api.FlashItem org.openlaszlo.iv.flash.api.FlashObject org.openlaszlo.iv.flash.api.FlashDef org.openlaszlo.iv.flash.api.Script
Script | final public class Script extends FlashDef (Code) | | Flash movie clip
Contains a timeline, a background color and generator commands of script level.
Excerpt from flash file format specs:
A script corresponds to a 'movie clip' in the Flash user-interface.
It is a movie contained within a movie, and supports many of the features of a regular Flash movie, including:
- Most of the control tags that can be used in the main movie.
- A timeline that can stop, start and play independently of the main movie.
- A streaming sound track that is automatically mixed with the main sound track.
A script object is defined with a DefineSprite tag. It consists of a character ID, a frame count, and a
series of control tags. Definition tags (such as DefineShape) are not allowed in the DefineSprite tag.
All the characters referred to by control tags in the sprite must be defined outside the sprite,
and before the DefineSprite tag.
Once defined, a script is displayed with a PlaceObject2 tag in the main movie. The transform (specified in
PlaceObject) is concatenated with the transforms of objects placed inside the script. These objects behave
like 'children' of the script, so when the script is moved, the objects inside the script move also.
Similarly, when the script is scaled or rotated, the child objects are also scaled or rotated.
A script object stops playing automatically when it is removed from the display list.
author: Dmitry Skavish |
Constructor Summary | |
public | Script() | public | Script(int frameNumber) | public | Script(int objID, int frameNumber) Creates empty script with specified initial capacity and ID
The capacity specifies the capacity of this script's
timeline (in frames). |
Method Summary | |
protected void | addGlobalCommand(GenericCommand cmd) | public Frame | addTweening(FlashDef def, int layer, int startFrame, AffineTransform startMatrix, CXForm startCXF, int endFrame, AffineTransform endMatrix, CXForm endCXF) | public Frame | addTweening(FlashDef def, int layer, int startFrame, AffineTransform startMatrix, CXForm startCXF, int endFrame, AffineTransform endMatrix, CXForm endCXF, String name) | public Frame | addTweening(FlashDef def, int layer, Frame frame, int num, AffineTransform startMatrix, CXForm startCXF, AffineTransform endMatrix, CXForm endCXF) | public Frame | addTweening(FlashDef def, int layer, Frame frame, int num, AffineTransform startMatrix, CXForm startCXF, AffineTransform endMatrix, CXForm endCXF, String name) | public void | appendScript(Script sc) Appends specified script to the end of this script
Removes all hanging instances of this script, i.e. | public void | apply(Context context) | public void | collectDeps(DepsCollector dc) | public void | collectFonts(FontsCollector fc) | protected FlashItem | copyInto(FlashItem item, ScriptCopier copier) | public Script | copyScript() | public void | fadeOut(int num) | public Instance | findInstance(String name) Finds nested script's instance by name
Searches instance of a script in this script
and in all nested scripts by instance's name. | public void | generate(FlashOutput fob) Writes content of this script to flash buffer
This method has to be used only if this script is main script. | public void | generate(FlashOutput fob, FontsCollector fc1, FontsCollector pfc, boolean hasPreloader) Writes content of this script to flash buffer
This method has to be used only if this script is main script. | public SetBackgroundColor | getBackgroundColor() | public Rectangle2D | getBounds() | public FlashItem | getCopy(ScriptCopier copier) | public Frame | getFrameAt(int frameNum) | public int | getFrameCount() | public int | getFrameIndex(Frame frame) | public Frame | getLastFrame() | public int | getMaxDepth() | public IVVector | getOccupiedLayers() | public int | getTag() | public Timeline | getTimeline() | public IVVector | getZero_frame() | public static AffineTransform | interLinear(double t, AffineTransform startMatrix, AffineTransform endMatrix) | public boolean | isConstant() | public boolean | isMain() | public boolean | isProcessed() | protected void | mergeFonts(IVVector fonts) | public Frame | newFrame() | public static Script | parse(Parser p, boolean isMain) | public void | printContent(PrintStream out, String indent) | public void | process(FlashFile file, Context context) | public void | removeAllInstances(Frame lastFrame) Removes all hanging instances of the timeline in the specified frame
Traverses this script and for every hanging instance (instance which is
still on the timeline by the last frame) puts RemoveObject tag in the specified frame. | public void | removeFileDepGlobalCommands() Removes global commands from this script which have to appear
only once in a file. | public int | reserveLayers(int from, int num) Reserves specified number of layers beginning from the specified one
Traverses the timeline and moves all the instances which are on layers
greater than the specified one by the specified number. | public void | resetMain() | public void | setBackgroundColor(SetBackgroundColor bkgColor) | public void | setMain() | public void | setProcessed() | public void | write(FlashOutput fob) Writes content of this script to flash buffer
This method has to be used only if this script is NOT a main script. |
Script | public Script()(Code) | | Creates empty script
|
Script | public Script(int frameNumber)(Code) | | Creates empty script with specified initial capacity
Parameters: frameNumber - initial capacity of this script in frames See Also: Script.Script(int,int) |
Script | public Script(int objID, int frameNumber)(Code) | | Creates empty script with specified initial capacity and ID
The capacity specifies the capacity of this script's
timeline (in frames). It does not specify how many frames
this script will eventually have.
Parameters: objID - ID of this script, if it's -1, then this is a main script Parameters: frameNumber - initial capacity of this script in frames |
addTweening | public Frame addTweening(FlashDef def, int layer, int startFrame, AffineTransform startMatrix, CXForm startCXF, int endFrame, AffineTransform endMatrix, CXForm endCXF)(Code) | | Adds simple motion and color tweening to this script
Parameters: def - symbol to be tweened Parameters: layer - layer on which to place the symbol and do the tweening Parameters: startFrame - start frame Parameters: startMatrix - start transformation matrix Parameters: startCXF - start color matrix (optional) Parameters: endFrame - end frame (included) Parameters: endMatrix - end transformation matrix Parameters: endCXF - end color matrix (optional) last frame |
addTweening | public Frame addTweening(FlashDef def, int layer, int startFrame, AffineTransform startMatrix, CXForm startCXF, int endFrame, AffineTransform endMatrix, CXForm endCXF, String name)(Code) | | Adds simple motion and color tweening to this script
Parameters: def - symbol to be tweened Parameters: layer - layer on which to place the symbol and do the tweening Parameters: startFrame - start frame Parameters: startMatrix - start transformation matrix Parameters: startCXF - start color matrix (optional) Parameters: endFrame - end frame (included) Parameters: endMatrix - end transformation matrix Parameters: endCXF - end color matrix (optional) Parameters: name - instance name last frame |
addTweening | public Frame addTweening(FlashDef def, int layer, Frame frame, int num, AffineTransform startMatrix, CXForm startCXF, AffineTransform endMatrix, CXForm endCXF)(Code) | | Adds simple motion and color tweening to this script
Parameters: def - symbol to be tweened Parameters: layer - layer on which to place the symbol and do the tweening Parameters: frame - first frame to start the tweening Parameters: num - number of frames for the tweening (in addition to the first frame) Parameters: startMatrix - start transformation matrix Parameters: startCXF - start color matrix (optional) Parameters: endMatrix - end transformation matrix Parameters: endCXF - end color matrix (optional) last frame |
addTweening | public Frame addTweening(FlashDef def, int layer, Frame frame, int num, AffineTransform startMatrix, CXForm startCXF, AffineTransform endMatrix, CXForm endCXF, String name)(Code) | | Adds simple motion and color tweening to this script
Parameters: def - symbol to be tweened Parameters: layer - layer on which to place the symbol and do the tweening Parameters: frame - first frame to start the tweening Parameters: num - number of frames for the tweening (in addition to the first frame) Parameters: startMatrix - start transformation matrix Parameters: startCXF - start color matrix (optional) Parameters: endMatrix - end transformation matrix Parameters: endCXF - end color matrix (optional) Parameters: name - instance name (optional), is set on first instance last frame |
appendScript | public void appendScript(Script sc)(Code) | | Appends specified script to the end of this script
Removes all hanging instances of this script, i.e. for every instance
which is still on the timeline by the of this script put RemoveObject
tag in the last frame of the timeline. Then adds all frames of the specified
script to the end of this one.
Parameters: sc - script to be appended |
copyScript | public Script copyScript()(Code) | | Creates a copy of this script
copy of this script |
fadeOut | public void fadeOut(int num)(Code) | | Fades out everything on the timeline during the specified number of frames
Parameters: num - number of frames |
findInstance | public Instance findInstance(String name)(Code) | | Finds nested script's instance by name
Searches instance of a script in this script
and in all nested scripts by instance's name.
Parameters: name - name of the instance to be searched found Script or null |
generate | public void generate(FlashOutput fob)(Code) | | Writes content of this script to flash buffer
This method has to be used only if this script is main script.
Parameters: fob - flash buffer to write See Also: Script.isMain See Also: Script.write |
generate | public void generate(FlashOutput fob, FontsCollector fc1, FontsCollector pfc, boolean hasPreloader)(Code) | | Writes content of this script to flash buffer
This method has to be used only if this script is main script.
Parameters: fob - flash buffer to write Parameters: fc1 - Parameters: pfc - preloader fonts Parameters: hasPreloader - true if preloader exists See Also: Script.isMain See Also: Script.write |
getBackgroundColor | public SetBackgroundColor getBackgroundColor()(Code) | | Returns background color of this script
background color of this script |
getBounds | public Rectangle2D getBounds()(Code) | | Calculates bounds of this script
Takes masks into account too
bounds of this script |
getFrameAt | public Frame getFrameAt(int frameNum)(Code) | | Returns frame at specified index
If frame does not exist, creates it at specified index and fills everything
in between with empty frames
Parameters: frameNum - frame number frame at specified index |
getFrameCount | public int getFrameCount()(Code) | | Returns number of frames in this script
number of frames |
getFrameIndex | public int getFrameIndex(Frame frame)(Code) | | Returns index of specified frame in the timeline or -1
Parameters: frame - specified frame index of specified frame in the timeline or -1 |
getLastFrame | public Frame getLastFrame()(Code) | | Returns last frame of this script
last frame of this script |
getMaxDepth | public int getMaxDepth()(Code) | | Returns maximum layer's depth of this script
maximum depth |
getOccupiedLayers | public IVVector getOccupiedLayers()(Code) | | Returns vector of all occupied layers by the end of this script
vector which contains Instances at 'layer' indexes |
getTag | public int getTag()(Code) | | |
getTimeline | public Timeline getTimeline()(Code) | | Returns this script's timeline
script's timeline |
getZero_frame | public IVVector getZero_frame()(Code) | | zero_frame IVVector accessor
IVVector |
interLinear | public static AffineTransform interLinear(double t, AffineTransform startMatrix, AffineTransform endMatrix)(Code) | | Creates linear interpolation of the two specified matrixes
Parameters: t - coefficient of the interpolation [0..1] Parameters: startMatrix - first matrix Parameters: endMatrix - second matrix interpolation of the two specified matrixes |
isConstant | public boolean isConstant()(Code) | | |
isMain | public boolean isMain()(Code) | | Returns true if this script is a main script
Main script is a script which represents main flash timeline
true if this is a main script |
isProcessed | public boolean isProcessed()(Code) | | Returns true if this script was already processed
true if this script was already processed |
mergeFonts | protected void mergeFonts(IVVector fonts)(Code) | | Merges the same fonts into one
Parameters: fonts - vector of fonts (FontDefs) |
newFrame | public Frame newFrame()(Code) | | Creates new frame and adds it to the end of the timeline
new added frame |
parse | public static Script parse(Parser p, boolean isMain) throws IVException(Code) | | Parses script
Parameters: p - parser Parameters: isMain - true if script to be parsed is main new parsed script exception: IVException - |
process | public void process(FlashFile file, Context context) throws IVException(Code) | | Processes this script in the specified context and flash file
Parameters: file - file to be used when processing this script Parameters: context - context to be used when processing this script exception: IVException - |
removeAllInstances | public void removeAllInstances(Frame lastFrame)(Code) | | Removes all hanging instances of the timeline in the specified frame
Traverses this script and for every hanging instance (instance which is
still on the timeline by the last frame) puts RemoveObject tag in the specified frame.
Parameters: lastFrame - frame to put RemoveObject tags in |
removeFileDepGlobalCommands | public void removeFileDepGlobalCommands()(Code) | | Removes global commands from this script which have to appear
only once in a file. For example: MovieSetCommand
Usually all templates loaded into another one need to have these global
commands stripped out
|
reserveLayers | public int reserveLayers(int from, int num)(Code) | | Reserves specified number of layers beginning from the specified one
Traverses the timeline and moves all the instances which are on layers
greater than the specified one by the specified number.
For example if we have instances A, B, C, D on layers 2,3,4,5,
then if we call reserveLayers(3,2) we will have:
A on 2, B on 5, C on 6, D on 7, so there will be two available layers depths: 3 and 4.
Parameters: from - reserve layers beginning from this one Parameters: num - number of layers to be reserved 'from' layer |
resetMain | public void resetMain()(Code) | | Sets this script to be NOT main script
|
setBackgroundColor | public void setBackgroundColor(SetBackgroundColor bkgColor)(Code) | | Sets new background color
Parameters: bkgColor - new color |
setMain | public void setMain()(Code) | | Sets this script to be main
|
setProcessed | public void setProcessed()(Code) | | Marks this script as processed
|
write | public void write(FlashOutput fob)(Code) | | Writes content of this script to flash buffer
This method has to be used only if this script is NOT a main script.
Parameters: fob - flash buffer to write See Also: Script.isMain See Also: Script.generate |
|
|