Re: [flexcoders] destroyChild + TextField.. bug?

2005-04-10 Thread Scott Barnes

ahuh! i found a legit bug hehe.

I'll keep playing and use that doLater approach aswell, but if i find
another way i'll post here. Thanks for looking into it, it helped a
lot! heh.

Scott.



On Apr 9, 2005 3:26 AM, Abdul Qabiz [EMAIL PROTECTED] wrote:
 
 Hi Scott,
 
 It seems to be bug/limitation, I will report it...
 
 You can reproduce this with the simple code like this...
 
 mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
 mx:Script
 ![CDATA[
 
import mx.controls.TextArea;
 
 var ccInstance;
 
 function createInstance()
 {
 destroyChild(ccInstance);
  ccInstance = createChild(TextArea,ccInstance);
 }
 
 ]]
 /mx:Script
 mx:Button label=Create Instance click=createInstance()/
 /mx:Application
 
 In this case, you don't even need to edit the text, TextArea/TextInput is
 disabled in next click...
 
 There is workaround for your problem, if you keep little delay between
 destroyChild(..) and createChild(..) it works..
 
 Like this code use setInterval(..) and it works fine:
 
 ##DestroyCreateChildTest.mxml##
 
 mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
 mx:Script
 ![CDATA[
 
 import CustomComponent;
 import mx.controls.TextArea;
 
 var ccInstance;
 var delayIntervalId;
 
 function createInstance()
 {
 
 destroyChild(ccInstance);
 //ccInstance = createChild(TextArea,ccInstance);
 
 //delay the creation..hardcoded value..
 delayIntervalId = setInterval(
 
 mx.utils.Delegate.create(
 
 this,
 
 function()
 
 {
 
 clearInterval(delayIntervalId);
 
 ccInstance = createChild(TextArea,ccInstance);
 
 }
 
 ),
 
  0
 );
 
  }
 
 ]]
 /mx:Script
 
 mx:Button label=Create Instance click=createInstance()/
 /mx:Application
 
 Thanks for bringing up this issue...
 
 -abdul
 
 -Original Message-
 From: Scott Barnes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 07, 2005 7:16 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] destroyChild + TextField.. bug?
 
 I have a straightfoward MXML component and inside it, i have a
 textarea component.
 
 works as per normal just simple code at this point.
 
 - I use createChild to instantiate the mxml component in a container.
 - I use destroyChild to delete that instantiated mxml component.
 
 Heres the thing.
 - Its got default text, Preview.. - if i leave it alone, and destroy
 it always comes back (*thumbs up*).
 - If i then edit that text field, then delete it and create another
 one (ie new/fresh version) i can't type in the textfield / default
 text is gone.
 
 I think when destroyChild it does something in terms of event
 listeners? anyone had similiar things happen?
 
 --
 Regards,
 Scott Barnes
 http://www.mossyblog.com
 http://www.flexcoder.com (Coming Soon)
 
 Yahoo! Groups Links
 
 Yahoo! Groups Links
 
 
 
 
 


-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com (Coming Soon)


 
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/
 





Re: [flexcoders] destroyChild + TextField.. bug?

2005-04-10 Thread Manish Jethani

On Apr 10, 2005 2:38 PM, Scott Barnes [EMAIL PROTECTED] wrote:

 I'll keep playing and use that doLater approach aswell, 
[snip]

Seems like Abdul is right.  Chuck the doLater thing and use setInterval. :)

-- 
[EMAIL PROTECTED]
http://manish.revise.org/


 
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/
 





RE: [flexcoders] destroyChild + TextField.. bug?

2005-04-09 Thread Abdul Qabiz

I don't think setInterval(...) waits for one or more frame, does it?

doLater(..) though waits...

Anyways, both of the approaches can be used, doLater(..) is quite need but
developer doesn't want a frame delay, he can use setInterval(..)

--abdul 

-Original Message-
From: Manish Jethani [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 09, 2005 9:26 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] destroyChild + TextField.. bug?


On Apr 9, 2005 2:34 AM, Abdul Qabiz [EMAIL PROTECTED] wrote:

 Yeah, doLater(..) seems to be more better way, but it would wait for 1
 frame(around 83+ msecs @12fps)But that hardly matters...

setInterval() waits for one or more frames obviously, plus it's a
timer.  If this works with doLater() then that's the right solution.

-- 
[EMAIL PROTECTED]
http://manish.revise.org/


 
Yahoo! Groups Links



 





 
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/
 





Re: [flexcoders] destroyChild + TextField.. bug?

2005-04-09 Thread JesterXL

intervals can be called 10 per frame, so 30fps Flex movie can call 300 
intervals a second.  However, this isn't gurenteed, but onEnterFrame is. 
Thus, doLater can always be depended upon to be called nextFrame; intervals 
could be called this frame... a later frame, or a bunch of frames later; too 
risky.

My math might be off on the intervals, but I know for a fact doLater's can 
be depened upon.

- Original Message - 
From: Manish Jethani [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Saturday, April 09, 2005 4:37 PM
Subject: Re: [flexcoders] destroyChild + TextField.. bug?



On Apr 9, 2005 11:09 PM, Abdul Qabiz [EMAIL PROTECTED] wrote:

 I don't think setInterval(...) waits for one or more frame, does it?

The documentation says setInterval() calls the function only when the
playhead enters a frame.  setInterval(..., 0) might be an exception to
that rule, but given the above example and how it works alike with
doLater() and setInterval(), it seems like setInterval(..., 0) also
calls the function on the next frame enter... just that it might be
slightly more expensive than doLater() because of the timer.

-- 
[EMAIL PROTECTED]
http://manish.revise.org/



Yahoo! Groups Links








 
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/
 





RE: [flexcoders] destroyChild + TextField.. bug?

2005-04-08 Thread Abdul Qabiz

Hi Scott,

It seems to be bug/limitation, I will report it...

You can reproduce this with the simple code like this...

mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
mx:Script
![CDATA[

   import mx.controls.TextArea;

var ccInstance;
  
function createInstance()
{
destroyChild(ccInstance);
 ccInstance = createChild(TextArea,ccInstance); 
}

]]
/mx:Script
mx:Button label=Create Instance click=createInstance()/
/mx:Application 



In this case, you don't even need to edit the text, TextArea/TextInput is
disabled in next click...


There is workaround for your problem, if you keep little delay between
destroyChild(..) and createChild(..) it works..

Like this code use setInterval(..) and it works fine:


##DestroyCreateChildTest.mxml##

mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
mx:Script
![CDATA[

import CustomComponent;
import mx.controls.TextArea;

var ccInstance;
var delayIntervalId;

function createInstance()
{

destroyChild(ccInstance);
//ccInstance = createChild(TextArea,ccInstance); 

//delay the creation..hardcoded value..
delayIntervalId = setInterval(
 
mx.utils.Delegate.create(
 
this,
 
function()
 
{
 
clearInterval(delayIntervalId);
 
ccInstance = createChild(TextArea,ccInstance);
 
}
 
),
 

 0
);
 

   


 }

]]
/mx:Script

mx:Button label=Create Instance click=createInstance()/
/mx:Application


Thanks for bringing up this issue...

-abdul


-Original Message-
From: Scott Barnes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 7:16 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] destroyChild + TextField.. bug?


I have a straightfoward MXML component and inside it, i have a
textarea component.

works as per normal just simple code at this point.

- I use createChild to instantiate the mxml component in a container.
- I use destroyChild to delete that instantiated mxml component.

Heres the thing.
- Its got default text, Preview.. - if i leave it alone, and destroy
it always comes back (*thumbs up*).
- If i then edit that text field, then delete it and create another
one (ie new/fresh version) i can't type in the textfield / default
text is gone.

I think when destroyChild it does something in terms of event
listeners? anyone had similiar things happen?

-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com (Coming Soon)


 
Yahoo! Groups Links



 





 
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/
 





RE: [flexcoders] destroyChild + TextField.. bug?

2005-04-07 Thread Abdul Qabiz

Hey Scott,

Can you post a simplified code? I might give a try to reproduce it at my
end.

-abdul 

-Original Message-
From: Scott Barnes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 7:16 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] destroyChild + TextField.. bug?


I have a straightfoward MXML component and inside it, i have a
textarea component.

works as per normal just simple code at this point.

- I use createChild to instantiate the mxml component in a container.
- I use destroyChild to delete that instantiated mxml component.

Heres the thing.
- Its got default text, Preview.. - if i leave it alone, and destroy
it always comes back (*thumbs up*).
- If i then edit that text field, then delete it and create another
one (ie new/fresh version) i can't type in the textfield / default
text is gone.

I think when destroyChild it does something in terms of event
listeners? anyone had similiar things happen?

-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com (Coming Soon)


 
Yahoo! Groups Links



 





 
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/