7.20.06 TextField type=input live preview resize issue

I found an issue attempting to finish a new component. When attempting to display the risizing of a component as it’s on the stage in said component’s live preview movie if you redraw a TextField with type=’input’ the live preview movie will be broken. Instead attempt to soft-remove the TextField where it’s declared in the actionscript.

I add the following code to the stage’s actionscript in the live preview movie so that the component will re-size appropriately to the size of the drag-n-dropped component and it’s reflected properly in the stage where the user drops the component:

Stage.align = "TL";
Stage.scaleMode = "noScale"

obj = new Object ();
obj.onResize = function () {
    xchInputBox.__width = xch.__height = Stage.width;
    xchInputBox.__height = xch.__height = Stage.height;
    // re-render the component
    xchInputBox.init();
}

Stage.addListener (obj);

Download this code: snippet/live-preview-resizeStage

xchInputBox is the instance name of the dropped component in the live preview movie. The xch object refers to a blank MovieClip in the library that magically acts as the parent MovieClip as it’s modified in the later IDE as a component - it is the faux object where all the component parameters will reside during design-time so that the live preview movie can on-the-fly handle the component parameter changes. This is where the function onUpdate() { } call comes into play. This function resides in the stage’s _root actionscript on frame 1 after a call to stop();

Back to the topic at hand… if you want the resizing of the parent MovieClip affect the size of the TextField with a type=’input’ in the live preview you’ll need to delete the TextField before every single redraw. In my case the onResize function applied to the live preview’s Stage set’s the component’s width and height as per the resized stage’s and then makes a call to my init() function which draws the component. At the top of the init function it’s wise to clear all the dynamic items. Again, in my case I need to remove the TextField that gets created every time init() is called:

function init ():Void {
...
    this["input"].removeTextField();
    this.createTextField("input", this.getNextHighestDepth(), 0, 0, this.__width, this.__height);
...
}

Download this code: snippet/live-preview-resizeInput

which is a soft-delete. What I mean is that a compiler error will not be thrown for non-existant object for the first call to init(); This quietly kills the variable and then immediately recreates it - and this only happens in the live-preview.

Another important note is in these redraw functions heavily used in your live-preview update functions, use the this.clear() call to remove all MovieClip drawings - just something to watch out for if you ever use lineTo() or curveTo().


2 Comments
Paul @ 10.30.06 8pm

I am receiving junk email from the following address:
jfgackbx@overset.com

I do not think that you are sending this spam email, so I am writing you rather than reporting your site. Being a tech website, you may want to put in some safeguards. I get these similiar junk mails from sites that are being spoofed from a china isp.

thanks and take care.

Paul

#20 366chars
jim @ 10.30.06 9pm

Paul
Interesting.
Spoofed email is spoofed email. This is worth talking to your email provider adding limitations to only allow emails from a verified IP block as per domain name from the originating mailer. Most admins I’ve worked with spend a great deal of time making sure that the dns (which should match the MX record on the from or reply-to address’ domain) will resolve both forward and reverse. It’s a little beyond my control to be honest when it comes to even the worst case of spoofing email.

That and to answer your question: no, I’m not spamming from this domain - nor is there an open relay.

#21 610chars



monetary contributions are always accepted $
0.345s