Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-23-2004, 09:08 PM   #1
Pixel
Master of Monkeys
 
Join Date: Sep 2001
Location: Toronto
Posts: 132
Send a message via ICQ to Pixel
Default custom class question

hey there guys .. i have a question i hope is relatively simple that someone can help with.

i have a custom class I am trying to make attach radio buttons and check box dynamically ... what is happening is as soon as i attach my check boxes, those are fine, lets say i attach 5 check boxes, no problem, but if i try to attach 3 radio buttons to go along with my check boxes, it writes the 3 radio buttons, then only attaches 2 check boxes. Hard to explain, but here is my code.

ActionScript Code:
class FormSuper extends MovieClip{         // this function creates our form from the fla     public static function createForm (formSymbol:String, itemName:String, depth:Number, xpos:Number, ypos:Number,                                        checked:Boolean, visibility:Boolean, count:Number, labelArray:Array, groupName:String):FormSuper {         for (var i:String=0; i<=count; i++) {             _root.attachMovie(formSymbol, itemName+i, i);             _root[itemName+i].setSize(200, 20);             _root[itemName+i]._x = xpos;             _root[itemName+i]._y = ypos;             _root[itemName+i].groupName = groupName;         _root[itemName+i]._y = _root[itemName+(i-1)]._y+_root[itemName+(i-1)]._height + 20;             _root[itemName+i].label = labelArray[i];             trace(itemName+i);             //trace (labelArray);         } }

then here is my code in my fla to attach the radio and check boxes, with the text labels.

ActionScript Code:
var checkBoxLabels = new Array ("this is checkbox 1", "this is checkbox2", "this is checkbox3", "this is checkbox4", "this is checkbox5", "this is checkbox6"); var radioLabels = new Array ("this is radio button1", "this is radio button2", "this is radio button3"); var sf2:FormSuper = FormSuper.createForm("CheckBox", "MyCheckBox", 1, 300, 100, true, true, 5, checkBoxLabels); var sf3:FormSuper = FormSuper.createForm("RadioButton", "MyRadioButton", 2, 150, 100, true, true, 2, radioLabels, "RadioGroup1");

Hope someone can help me with this ... thanks
joshua
Pixel is offline   Reply With Quote
Old 08-24-2004, 02:31 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

since this is obviously a mx2004 question, you will likely get more replys in the mx2004 forum.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 08-24-2004, 03:32 PM   #3
devonair
ET3
 
Join Date: May 2004
Location: Sicily
Posts: 332
Default

Pixel,

it's the attachMovie line in the class giving you problems.. Since with each FormSuper you create, you start from 0, therefore attach mc's on levels already taken replacing those mc's (hopefully, that made since). Try replacing your i with _root.getNextHighestDepth(), like:
PHP Code:
_root.attachMovie(formSymbolitemName i_root.getNextHighestDepth()); 
hope that helps..

d.
devonair is offline   Reply With Quote
Old 08-24-2004, 03:39 PM   #4
Pixel
Master of Monkeys
 
Join Date: Sep 2001
Location: Toronto
Posts: 132
Send a message via ICQ to Pixel
Default custom class question

thanks for the tip ... however, i tried that and now it just spits out the very last radio button, which is strange.

when i trace the objects its creating, it is creating them all ... but wiping them out as the new object is being created.

joshua

Last edited by Pixel; 08-24-2004 at 08:46 PM.
Pixel is offline   Reply With Quote
Reply


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 11:52 PM.

///
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.