RE: [Flashcoders] Duplicating MC with Loader inside

2006-01-22 Thread Adrian Lynch
Well, this is what I've come up with:

// Show the MC with Loader that we will duplicate below
loaderContainer.loaderToDupe.contentPath = "dupe_loader.jpg";
loaderContainer.loaderToDupe.scaleContent = false;
loaderContainer.loaderToDupe.load();

loaderContainer.duplicateMovieClip("newLoaderContainer", 10);

// Defined a function in the yet to be initialised nested Loader
newLoaderContainer.loaderToDupe.whatToDo = function() {
trace("whatDoTo called");
this._x += 50;
this._y += 50;
this.contentPath = "dupe_loader.jpg";
this.scaleContent = false;
this.load();
};

// Use the container's oEF to wait for the existence of the loader's doLater
newLoaderContainer.onEnterFrame = function() {

if ( this.loaderToDupe.doLater != undefined ) {

trace("doLater() is there");
this.loaderToDupe.doLater(this.loaderToDupe, "whatToDo");
this.onEnterFrame = undefined;

} else {
trace("doLater() isn't there yet, so wait");
}

};

It assumes an MC, loaderContainer, with a Loader inside, loaderToDupe and an
image to load, dupe_loader.jpg.

If anyone has any thoughts on this I'd still like to hear them.

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:26
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Duplicating MC with Loader inside


Maybe doLater is the property I wait to be defined?

Ade

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:09
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Duplicating MC with Loader inside


Would UIObject.doLater() be of any use?

>From the docs:
"Method; calls a user-defined function only after the component has finished
setting all of its properties from the Property inspector or Component
inspector. All version 2 components that inherit from UIObject have the
doLater() method."

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:04
To: Flashcoders
Subject: [Flashcoders] Duplicating MC with Loader inside


I knew of an initialisation problem with nested Loaders from another project
I did. Back then I didn't look too much in to it but this time I want to see
if I can find a solution.

Here's what I have and what I'm doing/trying to do:

- I have an MC on stage, inside this is a Loader component.

- I duplicate this MC, and hence the Loader inside it.

- I then set the properties' of the duped MC's Loader, contentPath and
scaleContent, and then call it's load() method.

If I do the above in sequence, the duped MC's Loader isn't initialised by
the time I try to set it's properties'.

If I delay using the duped MC's Loader, and instead fire an event that does
it, a button click for example, the Loader works fine.

I can think of two solutions, but I'm not too sure about them.

1. Set an interval to give the Loader time to get ready and then set the
properties.

2. Do the duping, check using an onEnterFrame to see if the nested Loaders
properties' exist and then set them.

The problem with 1 is, how long is long enough?

The problem with 2 is, will I get away with checking one property or will I
have to check them all? For example, I can check to see that contentPath is
difined, but what if load() isn't?

Does anyone have any thoughts on this?

I suppose another question is, how can you tell if a component if fully
initialised and ready to use?

Thanks.

Adrian

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Duplicating MC with Loader inside

2006-01-22 Thread Adrian Lynch
Maybe doLater is the property I wait to be defined?

Ade

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:09
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Duplicating MC with Loader inside


Would UIObject.doLater() be of any use?

>From the docs:
"Method; calls a user-defined function only after the component has finished
setting all of its properties from the Property inspector or Component
inspector. All version 2 components that inherit from UIObject have the
doLater() method."

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:04
To: Flashcoders
Subject: [Flashcoders] Duplicating MC with Loader inside


I knew of an initialisation problem with nested Loaders from another project
I did. Back then I didn't look too much in to it but this time I want to see
if I can find a solution.

Here's what I have and what I'm doing/trying to do:

- I have an MC on stage, inside this is a Loader component.

- I duplicate this MC, and hence the Loader inside it.

- I then set the properties' of the duped MC's Loader, contentPath and
scaleContent, and then call it's load() method.

If I do the above in sequence, the duped MC's Loader isn't initialised by
the time I try to set it's properties'.

If I delay using the duped MC's Loader, and instead fire an event that does
it, a button click for example, the Loader works fine.

I can think of two solutions, but I'm not too sure about them.

1. Set an interval to give the Loader time to get ready and then set the
properties.

2. Do the duping, check using an onEnterFrame to see if the nested Loaders
properties' exist and then set them.

The problem with 1 is, how long is long enough?

The problem with 2 is, will I get away with checking one property or will I
have to check them all? For example, I can check to see that contentPath is
difined, but what if load() isn't?

Does anyone have any thoughts on this?

I suppose another question is, how can you tell if a component if fully
initialised and ready to use?

Thanks.

Adrian

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Duplicating MC with Loader inside

2006-01-22 Thread Adrian Lynch
Well, doLater wouldn't be defined either, so I can't use that.

Ade

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:09
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Duplicating MC with Loader inside


Would UIObject.doLater() be of any use?

>From the docs:
"Method; calls a user-defined function only after the component has finished
setting all of its properties from the Property inspector or Component
inspector. All version 2 components that inherit from UIObject have the
doLater() method."

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:04
To: Flashcoders
Subject: [Flashcoders] Duplicating MC with Loader inside


I knew of an initialisation problem with nested Loaders from another project
I did. Back then I didn't look too much in to it but this time I want to see
if I can find a solution.

Here's what I have and what I'm doing/trying to do:

- I have an MC on stage, inside this is a Loader component.

- I duplicate this MC, and hence the Loader inside it.

- I then set the properties' of the duped MC's Loader, contentPath and
scaleContent, and then call it's load() method.

If I do the above in sequence, the duped MC's Loader isn't initialised by
the time I try to set it's properties'.

If I delay using the duped MC's Loader, and instead fire an event that does
it, a button click for example, the Loader works fine.

I can think of two solutions, but I'm not too sure about them.

1. Set an interval to give the Loader time to get ready and then set the
properties.

2. Do the duping, check using an onEnterFrame to see if the nested Loaders
properties' exist and then set them.

The problem with 1 is, how long is long enough?

The problem with 2 is, will I get away with checking one property or will I
have to check them all? For example, I can check to see that contentPath is
difined, but what if load() isn't?

Does anyone have any thoughts on this?

I suppose another question is, how can you tell if a component if fully
initialised and ready to use?

Thanks.

Adrian

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Duplicating MC with Loader inside

2006-01-22 Thread Adrian Lynch
Would UIObject.doLater() be of any use?

>From the docs:
"Method; calls a user-defined function only after the component has finished
setting all of its properties from the Property inspector or Component
inspector. All version 2 components that inherit from UIObject have the
doLater() method."

Adrian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Adrian
Lynch
Sent: 22 January 2006 13:04
To: Flashcoders
Subject: [Flashcoders] Duplicating MC with Loader inside


I knew of an initialisation problem with nested Loaders from another project
I did. Back then I didn't look too much in to it but this time I want to see
if I can find a solution.

Here's what I have and what I'm doing/trying to do:

- I have an MC on stage, inside this is a Loader component.

- I duplicate this MC, and hence the Loader inside it.

- I then set the properties' of the duped MC's Loader, contentPath and
scaleContent, and then call it's load() method.

If I do the above in sequence, the duped MC's Loader isn't initialised by
the time I try to set it's properties'.

If I delay using the duped MC's Loader, and instead fire an event that does
it, a button click for example, the Loader works fine.

I can think of two solutions, but I'm not too sure about them.

1. Set an interval to give the Loader time to get ready and then set the
properties.

2. Do the duping, check using an onEnterFrame to see if the nested Loaders
properties' exist and then set them.

The problem with 1 is, how long is long enough?

The problem with 2 is, will I get away with checking one property or will I
have to check them all? For example, I can check to see that contentPath is
difined, but what if load() isn't?

Does anyone have any thoughts on this?

I suppose another question is, how can you tell if a component if fully
initialised and ready to use?

Thanks.

Adrian

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders