Ok... that does load the jpeg.  So my next question is why?  All the
examples that I can find do not have this.  e.g.
http://livedocs.macromedia.com/labs/as3preview/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000067.html

In this post (
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=587&threadid=1226015&enterthread=y)
the guy says that if he tries to load the jpeg in a call to enter_frame or
something similar then it does work.  Does it just come down to that you
shouldn't be trying to do things like that in the constructor of a AS only
project?  Everything else does seem to work (shapes, text, etc...) so that
doesn't seem like the correct answer to me.

On 1/11/07, grand_master_flash_x <[EMAIL PROTECTED]> wrote:

  try this:
public function load(url:String):void
{
var l:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain(
ApplicationDomain.currentDomain );
l.contentLoaderInfo.addEventListener( Event.COMPLETE,
onPicLoaded );
l.load( new URLRequest( url ), context );
}
-nick


--- In [email protected] <flexcoders%40yahoogroups.com>, "Collin
Peters" <[EMAIL PROTECTED]> wrote:
>
> The following code does not work... though according to all the
> examples I have seen it should
>
> package {
> import flash.display.Sprite;
> import flash.display.Loader;
> import flash.display.StageScaleMode;
> import flash.net.URLRequest;
> import flash.events.Event;
>
> public class AS_Project extends Sprite
> {
> private var picLoader:Loader;
>
> public function AS_Project()
> {
> stage.scaleMode = StageScaleMode.NO_SCALE;
>
> picLoader = new Loader();
> picLoader.addEventListener(Event.COMPLETE, onPicLoaded);
> picLoader.load(new URLRequest("assets/background.jpg"));
> trace("Start");
> }
>
> private function onPicLoaded(event:Event):void
> {
> trace("Loaded");
> this.addChild(picLoader.content);
> }
> }
> }
>
> The "Start" trace works, but the "Loaded" doesn't. Am I missing
> something simple?
>
> --
> Collin Peters
> Lead Software Developer
> InTouch Technology
>




--
Collin Peters
Lead Software Developer
InTouch Technology

Reply via email to