Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Omar Fouad
Yeah look at this
in the swf timeline:

import flash.events.*;

const ON_PRESSED:String = "onPressed";
var PressedId:int;

B1.id = 1;
B2.id = 2;

B1.addEventListener(MouseEvent.CLICK, sendId);
B2.addEventListener(MouseEvent.CLICK, sendId);

function sendId(e:MouseEvent):void {
PressedId = e.currentTarget.id;
dispatchEvent(new Event(ON_PRESSED));
}


this works..

On Tue, Apr 8, 2008 at 10:34 PM, Kenneth Kawamoto <[EMAIL PROTECTED]>
wrote:

> Have you tried dispatchEvent() ?
>
> Kenneth Kawamoto
> http://www.materiaprima.co.uk/
>
> Omar Fouad wrote:
>
> > Yeah they all work :) thanks so much...
> > But I wanna ask a question. Can I dispatch Events from the swf to be
> > listened in the container Movie?
> >
> > On Tue, Apr 8, 2008 at 9:54 PM, Bob Wohl <[EMAIL PROTECTED]> wrote:
> >
> >  Have you tried to do something along the lines of this:
> > >
> > >
> > > private var myObject:DisplayObject;
> > > public function getMap(link:String):void {
> > >  var ldr:Loader = new Loader();
> > >  var urlReq:URLRequest = new URLRequest("Maps/" + link);
> > >  ldr.load(urlReq);
> > >  Map_Container.addChild(ldr);
> > > myObject = ldr;
> > >   ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> > > getProject);
> > >  }
> > >  public function getProject(e:Event):void {
> > >  trace("Movie Loaded"); // works
> > >  trace(ldr.B1.Pid); //undefined.
> > > trace(myObject.B1.Pid)
> > >   }
> > >
> > >
> > >
> > > On Tue, Apr 8, 2008 at 12:23 PM, Omar Fouad <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > >  Hi list,
> > > >
> > > > I am loading an swf that contains two MovieClips into an AS3
> > > > Project, B1
> > > > and
> > > > B2.
> > > > in the fist (and only) frame of the swf loaded I added:
> > > >
> > > > B1.Pid = 1;
> > > > B2.Pid = 2;
> > > >
> > > > Now I would like to access that property from the class wich loads
> > > > that
> > > > SWF
> > > > here is the code I used:
> > > >
> > > > public function getMap(link:String):void {
> > > >   var ldr:Loader = new Loader();
> > > >   var urlReq:URLRequest = new URLRequest("Maps/" + link);
> > > >   ldr.load(urlReq);
> > > >   Map_Container.addChild(ldr);
> > > >   ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> > > > getProject);
> > > >   }
> > > >   public function getProject(e:Event):void {
> > > >   trace("Movie Loaded"); // works
> > > >   trace(ldr.B1.Pid); //undefined.
> > > >   }
> > > >
> > > > How can I access it? In AS2 I used to write the name of the
> > > > container
> > > > like:
> > > >
> > > > container.MC.property;
> > > >
> > > > But how in AS3?
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > Omar M. Fouad - Digital Emotions
> > > > http://www.omarfouad.net
> > > >
> > >
> > >
> >
> >
> >  ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Kenneth Kawamoto

Have you tried dispatchEvent() ?

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Omar Fouad wrote:

Yeah they all work :) thanks so much...
But I wanna ask a question. Can I dispatch Events from the swf to be
listened in the container Movie?

On Tue, Apr 8, 2008 at 9:54 PM, Bob Wohl <[EMAIL PROTECTED]> wrote:


Have you tried to do something along the lines of this:


private var myObject:DisplayObject;
public function getMap(link:String):void {
  var ldr:Loader = new Loader();
  var urlReq:URLRequest = new URLRequest("Maps/" + link);
  ldr.load(urlReq);
  Map_Container.addChild(ldr);
myObject = ldr;
   ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
getProject);
  }
  public function getProject(e:Event):void {
  trace("Movie Loaded"); // works
  trace(ldr.B1.Pid); //undefined.
trace(myObject.B1.Pid)
   }



On Tue, Apr 8, 2008 at 12:23 PM, Omar Fouad <[EMAIL PROTECTED]>
wrote:


Hi list,

I am loading an swf that contains two MovieClips into an AS3 Project, B1
and
B2.
in the fist (and only) frame of the swf loaded I added:

B1.Pid = 1;
B2.Pid = 2;

Now I would like to access that property from the class wich loads that
SWF
here is the code I used:

public function getMap(link:String):void {
   var ldr:Loader = new Loader();
   var urlReq:URLRequest = new URLRequest("Maps/" + link);
   ldr.load(urlReq);
   Map_Container.addChild(ldr);
   ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
getProject);
   }
   public function getProject(e:Event):void {
   trace("Movie Loaded"); // works
   trace(ldr.B1.Pid); //undefined.
   }

How can I access it? In AS2 I used to write the name of the container
like:

container.MC.property;

But how in AS3?

Thanks.

--
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net







___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Kenneth Kawamoto

"init" precedes "complete", so if you use Event.COMPLETE the properties
of loaded asset are readily available.

In AS2 things were the other way round: onLoadInit is fired after
onLoadComplete.

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Jason Van Pelt wrote:

Also, I think you may want to use Event.INIT instead of Event.COMPLETE

Jason Van Pelt
Interactive Developer
504.210.1232 (p) / 504.581.2731 (f)
Peter A. Mayer Advertising, Inc.
www.peteramayer.com


e.target.content


Kenneth Kawamoto
http://www.materiaprima.co.uk/

Omar Fouad wrote:
 > Hi list,
 >
 > I am loading an swf that contains two MovieClips into an AS3 Project, 
B1 and

 > B2.
 > in the fist (and only) frame of the swf loaded I added:
 >
 > B1.Pid = 1;
 > B2.Pid = 2;
 >
 > Now I would like to access that property from the class wich loads 
that SWF

 > here is the code I used:
 >
 > public function getMap(link:String):void {
 > var ldr:Loader = new Loader();
 > var urlReq:URLRequest = new URLRequest("Maps/" + link);
 > ldr.load(urlReq);
 > Map_Container.addChild(ldr);
 > ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
 > getProject);
 > }
 > public function getProject(e:Event):void {
 > trace("Movie Loaded"); // works
 > trace(ldr.B1.Pid); //undefined.
 > }
 >
 > How can I access it? In AS2 I used to write the name of the container 
like:

 >
 > container.MC.property;
 >
 > But how in AS3?
 >
 > Thanks.



___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Omar Fouad
Yeah they all work :) thanks so much...
But I wanna ask a question. Can I dispatch Events from the swf to be
listened in the container Movie?

On Tue, Apr 8, 2008 at 9:54 PM, Bob Wohl <[EMAIL PROTECTED]> wrote:

> Have you tried to do something along the lines of this:
>
>
> private var myObject:DisplayObject;
> public function getMap(link:String):void {
>   var ldr:Loader = new Loader();
>   var urlReq:URLRequest = new URLRequest("Maps/" + link);
>   ldr.load(urlReq);
>   Map_Container.addChild(ldr);
> myObject = ldr;
>ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> getProject);
>   }
>   public function getProject(e:Event):void {
>   trace("Movie Loaded"); // works
>   trace(ldr.B1.Pid); //undefined.
> trace(myObject.B1.Pid)
>}
>
>
>
> On Tue, Apr 8, 2008 at 12:23 PM, Omar Fouad <[EMAIL PROTECTED]>
> wrote:
>
> > Hi list,
> >
> > I am loading an swf that contains two MovieClips into an AS3 Project, B1
> > and
> > B2.
> > in the fist (and only) frame of the swf loaded I added:
> >
> > B1.Pid = 1;
> > B2.Pid = 2;
> >
> > Now I would like to access that property from the class wich loads that
> > SWF
> > here is the code I used:
> >
> > public function getMap(link:String):void {
> >var ldr:Loader = new Loader();
> >var urlReq:URLRequest = new URLRequest("Maps/" + link);
> >ldr.load(urlReq);
> >Map_Container.addChild(ldr);
> >ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> > getProject);
> >}
> >public function getProject(e:Event):void {
> >trace("Movie Loaded"); // works
> >trace(ldr.B1.Pid); //undefined.
> >}
> >
> > How can I access it? In AS2 I used to write the name of the container
> > like:
> >
> > container.MC.property;
> >
> > But how in AS3?
> >
> > Thanks.
> >
> > --
> > Omar M. Fouad - Digital Emotions
> > http://www.omarfouad.net
> >
> > This e-mail and any attachment is for authorised use by the intended
> > recipient(s) only. It may contain proprietary material, confidential
> > information and/or be subject to legal privilege. It should not be
> copied,
> > disclosed to, retained or used by, any other party. If you are not an
> > intended recipient then please promptly delete this e-mail and any
> > attachment and all copies and inform the sender. Thank you.
> > ___
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Bob Wohl
Have you tried to do something along the lines of this:


private var myObject:DisplayObject;
public function getMap(link:String):void {
   var ldr:Loader = new Loader();
   var urlReq:URLRequest = new URLRequest("Maps/" + link);
   ldr.load(urlReq);
   Map_Container.addChild(ldr);
myObject = ldr;
   ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
getProject);
   }
   public function getProject(e:Event):void {
   trace("Movie Loaded"); // works
   trace(ldr.B1.Pid); //undefined.
trace(myObject.B1.Pid)
   }



On Tue, Apr 8, 2008 at 12:23 PM, Omar Fouad <[EMAIL PROTECTED]> wrote:

> Hi list,
>
> I am loading an swf that contains two MovieClips into an AS3 Project, B1
> and
> B2.
> in the fist (and only) frame of the swf loaded I added:
>
> B1.Pid = 1;
> B2.Pid = 2;
>
> Now I would like to access that property from the class wich loads that
> SWF
> here is the code I used:
>
> public function getMap(link:String):void {
>var ldr:Loader = new Loader();
>var urlReq:URLRequest = new URLRequest("Maps/" + link);
>ldr.load(urlReq);
>Map_Container.addChild(ldr);
>ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> getProject);
>}
>public function getProject(e:Event):void {
>trace("Movie Loaded"); // works
>trace(ldr.B1.Pid); //undefined.
>}
>
> How can I access it? In AS2 I used to write the name of the container
> like:
>
> container.MC.property;
>
> But how in AS3?
>
> Thanks.
>
> --
> Omar M. Fouad - Digital Emotions
> http://www.omarfouad.net
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Jason Van Pelt
Also, I think you may want to use Event.INIT instead of Event.COMPLETE

Jason Van Pelt
Interactive Developer
504.210.1232 (p) / 504.581.2731 (f)
Peter A. Mayer Advertising, Inc.
www.peteramayer.com


e.target.content


Kenneth Kawamoto
http://www.materiaprima.co.uk/

Omar Fouad wrote:
> Hi list,
>
> I am loading an swf that contains two MovieClips into an AS3 Project, B1
and
> B2.
> in the fist (and only) frame of the swf loaded I added:
>
> B1.Pid = 1;
> B2.Pid = 2;
>
> Now I would like to access that property from the class wich loads that
SWF
> here is the code I used:
>
> public function getMap(link:String):void {
> var ldr:Loader = new Loader();
> var urlReq:URLRequest = new URLRequest("Maps/" + link);
> ldr.load(urlReq);
> Map_Container.addChild(ldr);
> ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> getProject);
> }
> public function getProject(e:Event):void {
> trace("Movie Loaded"); // works
> trace(ldr.B1.Pid); //undefined.
> }
>
> How can I access it? In AS2 I used to write the name of the container
like:
>
> container.MC.property;
>
> But how in AS3?
>
> Thanks.
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Omar Fouad
Thank you Kenneth :)

On Tue, Apr 8, 2008 at 9:45 PM, Kenneth Kawamoto <[EMAIL PROTECTED]>
wrote:

> e.target.content
>
>
> Kenneth Kawamoto
> http://www.materiaprima.co.uk/
>
> Omar Fouad wrote:
>
> > Hi list,
> >
> > I am loading an swf that contains two MovieClips into an AS3 Project, B1
> > and
> > B2.
> > in the fist (and only) frame of the swf loaded I added:
> >
> > B1.Pid = 1;
> > B2.Pid = 2;
> >
> > Now I would like to access that property from the class wich loads that
> > SWF
> > here is the code I used:
> >
> > public function getMap(link:String):void {
> >var ldr:Loader = new Loader();
> >var urlReq:URLRequest = new URLRequest("Maps/" + link);
> >ldr.load(urlReq);
> >Map_Container.addChild(ldr);
> >ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> > getProject);
> >}
> >public function getProject(e:Event):void {
> >trace("Movie Loaded"); // works
> >trace(ldr.B1.Pid); //undefined.
> >}
> >
> > How can I access it? In AS2 I used to write the name of the container
> > like:
> >
> > container.MC.property;
> >
> > But how in AS3?
> >
> > Thanks.
> >
> >  ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Accessing loaded content variables

2008-04-08 Thread Kenneth Kawamoto

e.target.content


Kenneth Kawamoto
http://www.materiaprima.co.uk/

Omar Fouad wrote:

Hi list,

I am loading an swf that contains two MovieClips into an AS3 Project, B1 and
B2.
in the fist (and only) frame of the swf loaded I added:

B1.Pid = 1;
B2.Pid = 2;

Now I would like to access that property from the class wich loads that SWF
here is the code I used:

public function getMap(link:String):void {
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("Maps/" + link);
ldr.load(urlReq);
Map_Container.addChild(ldr);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,
getProject);
}
public function getProject(e:Event):void {
trace("Movie Loaded"); // works
trace(ldr.B1.Pid); //undefined.
}

How can I access it? In AS2 I used to write the name of the container like:

container.MC.property;

But how in AS3?

Thanks.


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders