Adobe Dreamweaver Forums



Last 10 THreads :         strange bugs (Last Post : fazstp - Replies : 1 - Views : 5 )           »          ADOBE - Forum search is broken (Last Post : Amy Blankenship - Replies : 1 - Views : 2 )           »          move tab with embedded image (Last Post : Amy Blankenship - Replies : 2 - Views : 3 )           »          Update cross domain policy (Last Post : SoxFan33 - Replies : 3 - Views : 14 )           »          CF8 Help in Dreamweaver CS3 (Last Post : danilocelic AdobeCommunityExpert - Replies : 5 - Views : 6 )           »          Select Checked Out Files Within Folder (Last Post : ben_bloom - Replies : 0 - Views : 1 )           »          Library is missing names from splitter bar (Last Post : a_hayman - Replies : 4 - Views : 5 )           »          pop up blocker jacking my login (Last Post : JoeyD1978 - Replies : 3 - Views : 4 )           »          Help with navigation (Last Post : Jiva Mukta - Replies : 0 - Views : 1 )           »          Why is this not working!!! (Last Post : Boxing Boom - Replies : 3 - Views : 4 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 12-04-2008, 06:22 PM
clsimeone
 
Posts: n/a
Diggs:
Default Problem w/loaderInfo.loader. INIT event not dispatched.

I have a Flash app made up of AS3 components that I am trying to run in Flex.

In Flash, after the main component is added to the stage, the loader object
(loaderInfo.loader) is null which is fine and I handle that.

The same exact code in Flex has different results. On the applicationComplete
event I add the the main component to the stage and the loader object's getter
throws an exception - Error #2099: The loading object is not sufficiently
loaded to provide this information.

Also, the INIT event, which is supposed to be dispatched when the properties
and methods of a loaded SWF file are accessible, does not appear to be firing
which is probably part of the problem. But I can't figure out why it is not
being dispatched.

My code snippet of what happens when the object is instantiated is below.

This line of code in the function checkLoaderInfo(...) throws the exception:
if (this.loaderInfo.loader == null)

The exception is caught in handleAddedToStage(...) which adds handlers as
follows...
this.loaderInfo.addEventListener(Event.COMPLETE, checkLoaderInfo);
this.loaderInfo.addEventListener(Event.INIT, checkLoaderInfo);

The events are never dispatched and the Flex app just does nothing after that.
I just get that nice blue flex background...



Code:
public class FluidPlayer extends Container  // container is a MovieClip...
{
imports...
private vars...
public vars...

public function FluidPlayer():void
{
if(stage)
handleAddedToStage();
else
addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
}

private function handleAddedToStage(event:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
actionsource = new FluidActionSource();
addChild(actionsource);

try
{
checkLoaderInfo();
}
catch (error:Error)
{
this.loaderInfo.addEventListener(Event.COMPLETE, checkLoaderInfo);
this.loaderInfo.addEventListener(Event.INIT, checkLoaderInfo);
}

if (localConnectionName == "")
{
if (ExternalInterface.objectID)
localConnectionName = ExternalInterface.objectID;
else
localConnectionName = "FluidPlayer";
}

if (this.loaderInfo.parameters.hasOwnProperty("listeners"))
{
var listeners:String =
this.loaderInfo.parameters.listeners.replace(/\s/g,"");
fluidAPI = new FluidAPI(localConnectionName,listeners.split(","));
}
else
fluidAPI = new FluidAPI(localConnectionName);

contentArea = new FluidContentArea();
addChild(contentArea);

fluidController = FluidController.instance;
soundManager = SoundManager.instance;
}

private function checkLoaderInfo(event:Event = null):void
{
this.loaderInfo.removeEventListener(Event.COMPLETE, checkLoaderInfo);
this.loaderInfo.removeEventListener(Event.INIT, checkLoaderInfo);

if (this.loaderInfo.loader == null)
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, handleResize);
handleResize();

if (this.loaderInfo.parameters.hasOwnProperty("XMLData"))
loadXML(this.loaderInfo.parameters.XMLData);
else
trace("* Missing XMLData flashVar, listening for flashLoadXML()
API call...");

if (this.loaderInfo.parameters.hasOwnProperty("skin"))
loadStyleSheet(this.loaderInfo.parameters.skin);
else
trace("Missing skin flashVar, listening for flashLoadXML() API
call...");
}
}

...
...


Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 07:55 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk