Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-07-2004, 02:53 PM   #1
Registered User
Join Date: Jul 2004
Posts: 51
Default Dynamically creating CheckBoxes, weird result

I´m trying to get this code to create 3 CheckBoxes nicely alligned, and all of them with a selected = TRUE, value.
And then get those values on an array.
But this is what it gives me.

1. - It creates the three CheckBoxes.. but the first one is not alligned with the others.. it is created on the top left corner of the stage (0,0)...

2.- Also this first appears as unchecked, although when I retrieve the MyCheckboxArray, the results are: true, true, true.

Any Ideas? :

for (i=0; i<3; i++) {

createClassObject(mx.controls.CheckBox, "MyCheckbox"+i, i, {label:"whatever", groupName:"checkies", fontFamily:"fuentemenu", fontSize:"8"});
	_root["MyCheckbox"+i].setSize(130, 20);
	_root["MyCheckbox"+i].move(20, 110+30*i);
	_root["MyCheckbox"+i].selected = true;
            _root.MyCheckboxArray[i] = _root["MyCheckbox"+i].selected;
edgecrusher is offline   Reply With Quote
Old 08-09-2004, 05:39 PM   #2
Registered User
Join Date: Jul 2004
Posts: 51

Help me see the light
edgecrusher is offline   Reply With Quote
Old 08-12-2004, 12:39 AM   #3
Join Date: Jul 2004
Posts: 60

Let me start by saying that in general components require quite a bit of "Voodoo" to get working correctly. I see you are using createClassObject to create the components. You may want to check out this page at macromedia as well as this post. I personallly have had trouble with both methods, and components in general. The frustrating thing is that it seems like most developers on this board and many others do not use the v2 components, and absolutely have no knowledge about the v2 professional components. I'm sorry if this wasn't much help, I'm currently in the trenches with you trying to get components to work on my own projects - its not easy =P

Last edited by theflux; 08-12-2004 at 12:45 AM.
theflux is offline   Reply With Quote
Old 08-17-2004, 11:16 AM   #4
Join Date: Jul 2004
Location: brighton, uk
Posts: 73

I have a problem that I feel may be related.

I have built my own component that extends MovieClip
The component is appearing in the components panel and is behaving itself if I drag an instance of it onto the stage in design time.

However I would like to attach it through code using the createClassComponent method, and it is not doing so. Should I have extended a V2 class instead of a MovieClip class? And which one should I extend.

And mores to the point, how the frick am I to find this information out other than by trawling forums endlessly. Have I missed a crucial part of MM's documentation here?

(continues to moan about MM's support for mx 2004 pro documentation at length to anyone within earshot.......)
bleepbloop is offline   Reply With Quote
Old 08-17-2004, 11:29 AM   #5
Registered User
Join Date: Jul 2004
Posts: 51

Well I solved my problem... I´m not sure how..
I just rewrote a lot of code I was getting trouble with, and that Create Check Box ended inside a function that pretty much dynamically creates a bunch of clips, textfields and the checkboxes.
And it worked..

So I guess the problem was not the createClassObject, but something on my code.

Anyway, I´m puzzled as why it didn´t work before.. And I hope I don´t get many more jobs that need components... the ScrollPane gave me so much fight, I ended up an using an old fashioned DIY scroller.
With the amount of time I spent trying to figure out the ScrollPane issues (forums, a couple of books, trial and error, sacrificing chickens, hitting the PC with a sledgehammer, etc) I could have wrote three different approachs for DIY scrollers, and will not have aged 10 years in two weeks.
edgecrusher is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:32 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.