in your index.htm

change this:
function moveIFrame(x,y,w,h) {
    var frameRef=document.getElementById("myFrame");

to

function moveIFrame(x,y,w,h,ref) {
    var frameRef=document.getElementById(ref);
    frameRef.style.left=x;
    frameRef.style.top=y;
    frameRef.width=w;
    frameRef.height=h;
}

function hideIFrame(ref){
    document.getElementById(ref).style.visibility="hidden";
}

function showIFrame(){
    document.getElementById(ref).style.visibility="visible";
}

then in IFrame.mxml:

function moveIFrame(): Void {
            var pt={x:0, y:0};
            this.localToGlobal(pt);
            
getURL("javascript:moveIFrame("+pt.x+","+pt.y+","+this.width+","+this.height+")");

to:
function moveIFrame(ref): Void {
            var pt={x:0, y:0};
            this.localToGlobal(pt);
            
getURL("javascript:moveIFrame("+pt.x+","+pt.y+","+this.width+","+this.height+","+REF+")");

AND

        function set visible(visible: Boolean): Void {
            super.visible=visible;
            if (visible)
                getURL("javascript:showIFrame()");
                //fscommand("showIFrame");
            else
                getURL("javascript:hideIFrame()");
                //fscommand("hideIFrame");
        }

        function set source(source: String): Void {
            if (source) {
                __source = source;
                getURL(source,"myFrame");
            }
        }
TO

        function set visible(visible: Boolean, ref:String): Void {
            super.visible=visible;
            if (visible)
                getURL("javascript:showIFrame("+ref+")");
                //fscommand("showIFrame");
            else
                getURL("javascript:hideIFrame("+ref+")");
                //fscommand("hideIFrame");
        }

        function set source(source: String,ref:String): Void {
            if (source) {
                __source = source;
                getURL(source,ref);
            }
        }

Now when you want to execute it etc, simply make sure you pass in the
ref to the above methods according..

eg:

moveIFrame(200,300,0,0,'yourCustomIFRAME_ID');

Since his example is using getURL() its basic javascript calls back
and forth, and all i did above was swap out the ID hard-coding(s) for
dynamic ones. Depends on what you want to do of course, but
essentially thats pretty much it.

If you want it automated you could also do a list/iterator approach eg:


        function moveIFrame(): Void {
var idFrames = new Array("myFrame","myOtherFrame","myTestFrameEtc");

            var pt={x:0, y:0};
            this.localToGlobal(pt);
for(var i=0; i < idFrames.length; i++) {
getURL("javascript:moveIFrame("+pt.x+","+pt.y+","+this.width+","+this.height+","+idFrames[i]+")");
}
        }

Now also keeping in mind if you are managing multiple frames you may
want to do metric calcs for each one based on the stage size etc..

Hope that helps?




-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com ("Waiting for FLEX NCL to arrive")


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to