My guess is that your "this" variable is getting mixed up. I'm not
familiar with the "Delegate.function" usage, but that function may be
being called with a scope you're not expecting.
Try just using a regular function there. You've already set up the
'ref' member of the 'swfListen' object, so 'this.ref' should give you
what you want.
-Andy
On 9/6/07, Lee Marshall <[EMAIL PROTECTED]> wrote:
> I am trying to construct a class that loads in an external SWF. I have a
> movieclip in the external SWF called 'closer_mc' which I cannot get
> access to. I keep getting undefined in my output. Can anyone suggest
> anything?
>
>
>
> Cheers
>
>
>
> Code:
>
>
>
> class PopupIll {
>
> //Initialise variables
>
> public var t:MovieClip;
>
> public var a:MovieClip;
>
> public var closer_mc:MovieClip;
>
> public var popX:Number;
>
> public var popY:Number;
>
> public var popMovie:String;
>
> //++++Constructor function++++
>
> public function PopupIll(movieName:String, target:MovieClip,
> newX:Number, newY:Number, depth:Number, a:MovieClip) {
>
> t = target;
>
> t._x = newX;
>
> t._y = newY;
>
> var swfListen:Object = new Object();
>
> swfListen.ref = t;
>
> swfListen.ref2 = t.closer_mc;
>
> //Create listener object
>
> var swfMCLoader:MovieClipLoader = new
> MovieClipLoader();
>
> //Create MovieClipLoader
>
> swfListen.onLoadError =
> function(target_mc:MovieClip, errorCode:String, status:Number) {
>
> trace("Error loading image:
> "+errorCode);
>
> };
>
> swfListen.onLoadStart =
> function(target_mc:MovieClip):Void {
>
> //trace("onLoadStart: " +
> target_mc);
>
> };
>
> swfListen.onLoadProgress =
> function(target_mc:MovieClip, numBytesLoaded:Number,
> numBytesTotal:Number):Void {
>
> var numPercentLoaded:Number =
> numBytesLoaded/numBytesTotal*100;
>
> //trace("onLoadProgress: " +
> target_mc + " is " + numPercentLoaded + "% loaded");
>
> };
>
> swfListen.onLoadComplete =
> Delegate.function(target_mc:MovieClip, status:Number):Void {
>
> //trace("onLoadComplete: " +
> target_mc);
>
>
> //swfMCLoader.unloadClip(illHolder_mc);
>
> trace(this.ref.closer_mc);
>
> this.ref.closer_mc._x = 100;
>
> this.ref.closer_mc.onRelease =
> function() {
>
>
> this.ref.removeMovieClip();
>
> };
>
>
> //swfMCLoader.removeListener(swfListen);
>
> };
>
> swfMCLoader.addListener(swfListen);
>
> swfMCLoader.loadClip(movieName,t);
>
> }
>
> }
>
>
>
> Lee Marshall.
> Senior Media Designer/Developer
>
> Transart Educational Marketing Systems
> Clare Hall
> Parsons Green
> St Ives Business Park
> St Ives
> Cambridgeshire PE27 4WY
>
> Tel Direct Dial: +44(0)1480 499213
> Tel General Enquiries: +44(0)1480 499200
> Fax: +44(0)1480 499201
> email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> web: www.transart.co.uk <http://www.transart.co.uk/>
>
> Confidentiality notice:
> Please note that the information contained herein is highly confidential
> and may also be privileged and is for the named recipient(s) only, on no
> account should any part or details be disclosed to any third party
> without the prior written consent of Transart. In the event that you
> are not the intended recipient then please delete it and any copies that
> you have made and contact me on the above number.
>
> General statement:
> Any statements made, or intentions expressed in this communication may
> not necessarily reflect the view of Transart. Be advised that no
> content herein may be held binding upon Transart or any associated
> company unless confirmed by the issuance of a formal contractual
> document or purchase order.
>
>
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com