please see - I would like to use the image pic.jpg as the background for the flash animation. Please list the steps to do this. Ask me for any clarification needed. thank you in advance for your time and efforts.

Dani AI

Generated

This thread is old and important context has changed: Adobe ended Flash Player support in 2020, and modern browsers no longer run SWF content. If the goal is long‑term web delivery, consider exporting or porting the animation to HTML5 (Adobe Animate / CreateJS) or delivering a video fallback. See Adobe's Flash Player end‑of‑life notice for details: Adobe Flash Player EOL.

That said, for working inside the Flash IDE or an AIR app, the replies from , and point in the right directions. Add these practical, technical tips that aren’t in the replies: set bitmap compression in the Library/Publish settings to balance quality and SWF size; enable bitmap smoothing for scaled images; prepare a high‑quality source at the target or 2x size for high‑DPI screens; and use stage scale/align plus code to preserve aspect ratio rather than letting the player stretch content.

Example (ActionScript 3) — dynamic load + smoothing + aspect‑fit on resize:

import flash.display.Loader;
import flash.display.Bitmap;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

var bg:Bitmap;
var ow:Number;
var oh:Number;

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBgLoaded);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.load(new URLRequest("pic.jpg"));

function onBgLoaded(e:Event):void {
  bg = e.target.content as Bitmap;
  bg.smoothing = true;
  ow = bg.width; oh = bg.height;
  addChildAt(bg, 0);
  resizeBg();
  stage.addEventListener(Event.RESIZE, resizeBg);
}

function onLoadError(e:IOErrorEvent):void {
  trace("Background load failed:", e.text);
}

function resizeBg(e:Event = null):void {
  if (!bg) return;
  var sw:Number = stage.stageWidth;
  var sh:Number = stage.stageHeight;
  var s:Number = Math.max(sw / ow, sh / oh);
  bg.scaleX = bg.scaleY = s;
  bg.x = (sw - ow * s) / 2;
  bg.y = (sh - oh * s) / 2;
}

Troubleshooting: verify the image path relative to the SWF, test in the standalone debugger, and remember cross‑domain rules if loading images from other servers (pixel access is restricted without a crossdomain.xml). If the project must go online today, plan an HTML5 migration or provide a non‑Flash fallback.

Recommended Answers

All 3 Replies

Make a layer and insert the image there.

Lock the layer while you're working on other layes on top..

Also make sure this layer lies at the bottom of all layer.

One thing to point out is to get the best effect make sure that you don't stretch or distort the background image in flash... do it in photoshop or something similar. Make it the same size as the flash file you are using it with.

Member Avatar for Member #114696

You could also do that dynamically:

_root.createEmptyMovieClip("picture", 1);
picture.loadMovie("pic.jpg");

You can now set alpha, width, height as per your requirement. This is good because could just update images and there is no need to import it everytime after updating. Also it is good if you want random background. But yeah, consider roryt last post. That's really important.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.