target_mc.closer_mc.onRelease = Delegate.create(this, getPopHolder);


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lee Marshall
Sent: 07 September 2007 18:24
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Function call from a function

Still not working... I think it is a scoping issue.

Here's my code (Excuse the bloat, I am very much learning!)



import flash.filters.DropShadowFilter;
import mx.utils.Delegate;
class PopupIll {
        //Initialise variables
        public static var t:MovieClip;
        public static var ref:MovieClip;
        public static var popHolder:MovieClip;
        public var newX:Number;
        public var newY:Number;
        public var movieName:String;
        ////
        //++++Constructor function++++
        public function loadMC(movieName:String, newX:Number,
newY:Number, ref:MovieClip) {
                //The is used if there is a hyperlink call
                if (newX == undefined) {
                        var params = new Array();
                        params = movieName.split("|", 4);
                        movieName = params[0];
                        newX = parseInt(params[1]);
                        newY = parseInt(params[2]);
                }
                //         
                // Creates an empty MC which holds the popup and
blocker.
                popHolder = ref.createEmptyMovieClip("popHolder_mc",
ref.getNextHighestDepth());
                // Creates a child movie clip inside of "popHolder".
This is the movie clip the loadclip will replace.
                var popChild:MovieClip =
popHolder.createEmptyMovieClip("popChild_mc",
popHolder.getNextHighestDepth());
                //Creates a listener for the load of the external SWF
                var swfListen:Object = new Object();//Create listener
object
                var swfMCLoader:MovieClipLoader = new
MovieClipLoader();//Create MovieClipLoader
                //Get errors
                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");
                        //
                };
                //++++Routine when SWF is loaded++++
                swfListen.onLoadInit =
function(target_mc:MovieClip):Void  {
                        //Loads the blocker MC which contains the
invisible button
                        var a:MovieClip =
popHolder.attachMovie("blocker", "blocker_mc",
popHolder.getNextHighestDepth());
                        a.swapDepths(target_mc);//Swaps the depth odf
the loaded image and blocker
                        a.inv_btn.useHandCursor = false;//Hides cursor
for the invisible button
                        a.stop();
                        a._x = 0;
                        a._y = 0;
                        //Dropshadow parameters
                        var distance:Number = 5;
                        var angleInDegrees:Number = 45;
                        var color:Number = 0x000000;
                        var alpha:Number = 0.8;
                        var blurX:Number = 10;
                        var blurY:Number = 10;
                        var strength:Number = 1;
                        var quality:Number = 3;
                        var inner:Boolean = false;
                        var knockout:Boolean = false;
                        var hideObject:Boolean = false;
                        //Position MC
                        target_mc._x =
Stage.width/2+newX-target_mc._width/2;
                        target_mc._y =
Stage.height/2+newY-target_mc._height/2;
                        //Add dropsahow effect
                        var filter:DropShadowFilter = new
DropShadowFilter(distance, angleInDegrees, color, alpha, blurX, blurY,
strength, quality, inner, knockout, hideObject);
                        var filterArray:Array = new Array();
                        filterArray.push(filter);
                        target_mc.filters = filterArray; 
                        target_mc.closer_mc.onRelease = function() {
                                Delegate.create(this, getPopHolder);
                        //popHolder.removeMovieClip();
                        };
                        //Removes the loader listener
                        swfMCLoader.removeListener(swfListen);

                };
                swfMCLoader.addListener(swfListen);//Adds a listener to
the loading process
                swfMCLoader.loadClip(movieName,popChild);//Loads
external SWF
        }
        public function getPopHolder():Void {
                trace(getPopHolder());
                //popHolder.removeMovieClip();
                //return popHolder;
        }
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to