9Jan/100
How to Load JPEG or SWF file with loadMovie
Load JPEG or SWF file with loadMovie.
- Launch Flash Designer and choose "Blank Animation". Choose "Frame" > "Frame Size" to set movie dimensions. Enter 300 x 300 and click OK.
- Choose "Sprite" tool and draw a rectangle on the frame. Flash Designer will create new sprite and display blank "chessboard" frame.
- Choose "Movie" > "Go to Main Movie" to quit sprite thread. You should see "Sprite1" as the name of the empty sprite.
- Choose "Item" > "Placement properties" and check "ActionScript" target. Click OK.
- Choose "Item" > "Resize", uncheck "Keep proportions" and enter width and height that will match your jpeg image size. Click OK.
- Choose "Button" tool and draw a button below the sprite.
- Choose "Item" > "Edit Properties". Rename button to "Load Movie". Click OK.
- Choose "Action" > "OnClick", select "ActionScript" and enter the code:Sprite1.loadMovie("t1023.jpg");
Sprite1.play();The name must match your jpeg file name. Click OK.
- Choose "Frame" > "Frame Delay" and check "Stop" options to create static frame. Click OK.
- Choose "File" > "Export SWF file" and export flash movie to the same folder where your jpeg image is.
- Choose "File" > "Export Web Page". The page will popup in a new browser window.
- Click "Load Movie" in your Flash file to load jpeg image
JPEG image must be in baseline compression, progressive is not supported (Flash player will not show progressive JPEG). See http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_16389
Import JPEG image to Flash Designer to check if the image is not progressive compressed, use "File" > "Import Image" command. If the image is progressive Flash Designer will display a warning message.
Flash Designer 5.0.13.14 or earlier does not save "ActionScript Target" attribute. Upgrade to newer version to fix this.
To load image use ActionScript code:
Sprite1.loadMovie("imagename.jpg");
to load Flash movie use
Sprite1.loadMovie("flash.swf");
Similar Posts:
- MouseOver in ActionScript
- How to Popup a PDF file from Flash
- Load variables from a text file to flash
- How to Call frames in an external Flash movie
- How to create context menu for an item in Flash.
- onMouseMove, onMouseDown, onMouseUp in ActionScript.
- How to Import and play MP3 sounds with flash
- Creating and sending Flash INPUT fields
- Mouse Over Effect 2
- How To Insert dynamic Video or Flash movie