RE: [Flashcoders] Naming a loaded swf

2010-06-15 Thread Lehr, Theodore
that did the trick - thanks everyone...


From: flashcoders-boun...@chattyfig.figleaf.com 
[flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Glen Pike 
[g...@engineeredarts.co.uk]
Sent: Tuesday, June 15, 2010 11:10 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Naming a loaded swf

Okay - can you store a reference to the loaded content that you can use
to access it later, either as an instance variable or in an array?

On 15/06/2010 15:49, Lehr, Theodore wrote:
> Actually - both ways are giving me the same error:
>
> Error #2078: The name property of a Timeline-placed object cannot be modified
>
> 
> From: flashcoders-boun...@chattyfig.figleaf.com 
> [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu 
> [ktu_fl...@cataclysmicrewind.com]
> Sent: Tuesday, June 15, 2010 9:49 AM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Naming a loaded swf
>
> There is no need to cast. The Loader.content property is defined as a
> DisplayObject -
> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content
>
> but I should have been more strictly typed.
>
> function onComplete(loadEvent:Event):void {
>var loadedContent:DisplayObject = loadEvent.target.content;
>loadedContent.name = "MyName";
>addChild(loadedContent);
> }
>
>
> On Tue, Jun 15, 2010 at 9:47 AM, Glen Pikewrote:
>
>
>> Cast it to a DisplayObject then give that a name?
>>
>> var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
>> obj.name = "my instance";
>>
>> ...
>>
>>
>> On 15/06/2010 14:28, Lehr, Theodore wrote:
>>
>>
>>> I am loading a swf via something like:
>>>
>>> var loader:Loader = new Loader();
>>>
>>> function startLoad(dfile:String)
>>> {
>>> var nRequest:URLRequest = new URLRequest(dfile);
>>> loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
>>> loader.load(nRequest);
>>> }
>>>
>>> function onComplete(loadEvent:Event):void
>>> {
>>> addChild(loadEvent.currentTarget.content);
>>> }
>>>
>>> startLoad("some.swf");
>>>
>>> I want to be able to name the swf that gets loaded... right now it is just
>>> getting a random name like: instance77
>>>
>>> How can I name it?
>>>
>>> ___
>>> 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
> ___
> 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] Naming a loaded swf

2010-06-15 Thread Lehr, Theodore
awesome - thanks


From: flashcoders-boun...@chattyfig.figleaf.com 
[flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu 
[ktu_fl...@cataclysmicrewind.com]
Sent: Tuesday, June 15, 2010 11:03 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Naming a loaded swf

It's possible that because the content property is the root class of the
loaded swf that you have to set the name property of your document class.

parent.swf
Loader.load(child.swf)

child.swf
this.name = "MyName";

Maybe that is what you need to do. I'm going to run a test to find out

Ktu


On Tue, Jun 15, 2010 at 10:49 AM, Lehr, Theodore
wrote:

> Actually - both ways are giving me the same error:
>
> Error #2078: The name property of a Timeline-placed object cannot be
> modified
>
> 
> From: flashcoders-boun...@chattyfig.figleaf.com [
> flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu [
> ktu_fl...@cataclysmicrewind.com]
> Sent: Tuesday, June 15, 2010 9:49 AM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Naming a loaded swf
>
> There is no need to cast. The Loader.content property is defined as a
> DisplayObject -
>
> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content
>
> but I should have been more strictly typed.
>
> function onComplete(loadEvent:Event):void {
>  var loadedContent:DisplayObject = loadEvent.target.content;
>  loadedContent.name = "MyName";
>  addChild(loadedContent);
> }
>
>
> On Tue, Jun 15, 2010 at 9:47 AM, Glen Pike  >wrote:
>
> > Cast it to a DisplayObject then give that a name?
> >
> > var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
> > obj.name = "my instance";
> >
> > ...
> >
> >
> > On 15/06/2010 14:28, Lehr, Theodore wrote:
> >
> >> I am loading a swf via something like:
> >>
> >> var loader:Loader = new Loader();
> >>
> >> function startLoad(dfile:String)
> >> {
> >>var nRequest:URLRequest = new URLRequest(dfile);
> >>
>  loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
> >>loader.load(nRequest);
> >> }
> >>
> >> function onComplete(loadEvent:Event):void
> >> {
> >>addChild(loadEvent.currentTarget.content);
> >> }
> >>
> >> startLoad("some.swf");
> >>
> >> I want to be able to name the swf that gets loaded... right now it is
> just
> >> getting a random name like: instance77
> >>
> >> How can I name it?
> >>
> >> ___
> >> 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
> ___
> 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] Naming a loaded swf

2010-06-15 Thread Glen Pike
Okay - can you store a reference to the loaded content that you can use 
to access it later, either as an instance variable or in an array?


On 15/06/2010 15:49, Lehr, Theodore wrote:

Actually - both ways are giving me the same error:

Error #2078: The name property of a Timeline-placed object cannot be modified


From: flashcoders-boun...@chattyfig.figleaf.com 
[flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu 
[ktu_fl...@cataclysmicrewind.com]
Sent: Tuesday, June 15, 2010 9:49 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Naming a loaded swf

There is no need to cast. The Loader.content property is defined as a
DisplayObject -
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content

but I should have been more strictly typed.

function onComplete(loadEvent:Event):void {
   var loadedContent:DisplayObject = loadEvent.target.content;
   loadedContent.name = "MyName";
   addChild(loadedContent);
}


On Tue, Jun 15, 2010 at 9:47 AM, Glen Pikewrote:

   

Cast it to a DisplayObject then give that a name?

var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
obj.name = "my instance";

...


On 15/06/2010 14:28, Lehr, Theodore wrote:

 

I am loading a swf via something like:

var loader:Loader = new Loader();

function startLoad(dfile:String)
{
var nRequest:URLRequest = new URLRequest(dfile);
loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
loader.load(nRequest);
}

function onComplete(loadEvent:Event):void
{
addChild(loadEvent.currentTarget.content);
}

startLoad("some.swf");

I want to be able to name the swf that gets loaded... right now it is just
getting a random name like: instance77

How can I name it?

___
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
___
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] Naming a loaded swf

2010-06-15 Thread Ktu
It's possible that because the content property is the root class of the
loaded swf that you have to set the name property of your document class.

parent.swf
Loader.load(child.swf)

child.swf
this.name = "MyName";

Maybe that is what you need to do. I'm going to run a test to find out

Ktu


On Tue, Jun 15, 2010 at 10:49 AM, Lehr, Theodore
wrote:

> Actually - both ways are giving me the same error:
>
> Error #2078: The name property of a Timeline-placed object cannot be
> modified
>
> 
> From: flashcoders-boun...@chattyfig.figleaf.com [
> flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu [
> ktu_fl...@cataclysmicrewind.com]
> Sent: Tuesday, June 15, 2010 9:49 AM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Naming a loaded swf
>
> There is no need to cast. The Loader.content property is defined as a
> DisplayObject -
>
> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content
>
> but I should have been more strictly typed.
>
> function onComplete(loadEvent:Event):void {
>  var loadedContent:DisplayObject = loadEvent.target.content;
>  loadedContent.name = "MyName";
>  addChild(loadedContent);
> }
>
>
> On Tue, Jun 15, 2010 at 9:47 AM, Glen Pike  >wrote:
>
> > Cast it to a DisplayObject then give that a name?
> >
> > var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
> > obj.name = "my instance";
> >
> > ...
> >
> >
> > On 15/06/2010 14:28, Lehr, Theodore wrote:
> >
> >> I am loading a swf via something like:
> >>
> >> var loader:Loader = new Loader();
> >>
> >> function startLoad(dfile:String)
> >> {
> >>var nRequest:URLRequest = new URLRequest(dfile);
> >>
>  loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
> >>loader.load(nRequest);
> >> }
> >>
> >> function onComplete(loadEvent:Event):void
> >> {
> >>addChild(loadEvent.currentTarget.content);
> >> }
> >>
> >> startLoad("some.swf");
> >>
> >> I want to be able to name the swf that gets loaded... right now it is
> just
> >> getting a random name like: instance77
> >>
> >> How can I name it?
> >>
> >> ___
> >> 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
> ___
> 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] Naming a loaded swf

2010-06-15 Thread Lehr, Theodore
Actually - both ways are giving me the same error:

Error #2078: The name property of a Timeline-placed object cannot be modified


From: flashcoders-boun...@chattyfig.figleaf.com 
[flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu 
[ktu_fl...@cataclysmicrewind.com]
Sent: Tuesday, June 15, 2010 9:49 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Naming a loaded swf

There is no need to cast. The Loader.content property is defined as a
DisplayObject -
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content

but I should have been more strictly typed.

function onComplete(loadEvent:Event):void {
  var loadedContent:DisplayObject = loadEvent.target.content;
  loadedContent.name = "MyName";
  addChild(loadedContent);
}


On Tue, Jun 15, 2010 at 9:47 AM, Glen Pike wrote:

> Cast it to a DisplayObject then give that a name?
>
> var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
> obj.name = "my instance";
>
> ...
>
>
> On 15/06/2010 14:28, Lehr, Theodore wrote:
>
>> I am loading a swf via something like:
>>
>> var loader:Loader = new Loader();
>>
>> function startLoad(dfile:String)
>> {
>>var nRequest:URLRequest = new URLRequest(dfile);
>>loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
>>loader.load(nRequest);
>> }
>>
>> function onComplete(loadEvent:Event):void
>> {
>>addChild(loadEvent.currentTarget.content);
>> }
>>
>> startLoad("some.swf");
>>
>> I want to be able to name the swf that gets loaded... right now it is just
>> getting a random name like: instance77
>>
>> How can I name it?
>>
>> ___
>> 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
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Naming a loaded swf

2010-06-15 Thread Ktu
There is no need to cast. The Loader.content property is defined as a
DisplayObject -
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Loader.html#content

but I should have been more strictly typed.

function onComplete(loadEvent:Event):void {
  var loadedContent:DisplayObject = loadEvent.target.content;
  loadedContent.name = "MyName";
  addChild(loadedContent);
}


On Tue, Jun 15, 2010 at 9:47 AM, Glen Pike wrote:

> Cast it to a DisplayObject then give that a name?
>
> var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
> obj.name = "my instance";
>
> ...
>
>
> On 15/06/2010 14:28, Lehr, Theodore wrote:
>
>> I am loading a swf via something like:
>>
>> var loader:Loader = new Loader();
>>
>> function startLoad(dfile:String)
>> {
>>var nRequest:URLRequest = new URLRequest(dfile);
>>loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
>>loader.load(nRequest);
>> }
>>
>> function onComplete(loadEvent:Event):void
>> {
>>addChild(loadEvent.currentTarget.content);
>> }
>>
>> startLoad("some.swf");
>>
>> I want to be able to name the swf that gets loaded... right now it is just
>> getting a random name like: instance77
>>
>> How can I name it?
>>
>> ___
>> 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] Naming a loaded swf

2010-06-15 Thread Glen Pike

Cast it to a DisplayObject then give that a name?

var obj:DisplayObject = loadEvent.currentTarget as DisplayObject;
obj.name = "my instance";

...

On 15/06/2010 14:28, Lehr, Theodore wrote:

I am loading a swf via something like:

var loader:Loader = new Loader();

function startLoad(dfile:String)
{
var nRequest:URLRequest = new URLRequest(dfile);
loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
loader.load(nRequest);
}

function onComplete(loadEvent:Event):void
{
addChild(loadEvent.currentTarget.content);
}

startLoad("some.swf");

I want to be able to name the swf that gets loaded... right now it is just 
getting a random name like: instance77

How can I name it?

___
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] Naming a loaded swf

2010-06-15 Thread Ktu
Loader.content is a DisplayObject. DisplayObject have a .name property

function onComplete(loadEvent:Event):void {
  var loadedContent = loadEvent.target.content;
  loadedContent.name = "MyName";
  addChild(loadedContent);
}

Ktu

P.S. this is all right in as3 livedocs... Not that this is for you
specifically Ted, but more people need to learn how to read the
documentation.


On Tue, Jun 15, 2010 at 9:28 AM, Lehr, Theodore
wrote:

> I am loading a swf via something like:
>
> var loader:Loader = new Loader();
>
> function startLoad(dfile:String)
> {
>   var nRequest:URLRequest = new URLRequest(dfile);
>   loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
>   loader.load(nRequest);
> }
>
> function onComplete(loadEvent:Event):void
> {
>   addChild(loadEvent.currentTarget.content);
> }
>
> startLoad("some.swf");
>
> I want to be able to name the swf that gets loaded... right now it is just
> getting a random name like: instance77
>
> How can I name it?
>
> ___
> 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] Naming a loaded swf

2010-06-15 Thread Lehr, Theodore
I am loading a swf via something like:

var loader:Loader = new Loader();

function startLoad(dfile:String)
{
   var nRequest:URLRequest = new URLRequest(dfile);
   loader.contentLoaderInfo.addEventListener(Evenet.COMPLETE.onComplete);
   loader.load(nRequest);
}

function onComplete(loadEvent:Event):void
{
   addChild(loadEvent.currentTarget.content);
}

startLoad("some.swf");

I want to be able to name the swf that gets loaded... right now it is just 
getting a random name like: instance77

How can I name it?

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