473,599 Members | 3,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Boxes and creating MC instances

67 New Member
I have created a mc called Box and placed it in my library. Then i call the following code in my main timeline:
Expand|Select|Wrap|Line Numbers
  1.  
  2. var maxBox:Number = 300;
  3. var i:Number = 1;
  4. createNewBox();
  5.  
  6. function createNewBox(){
  7.    if(_root.i < maxBox){
  8.       var container_mc:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
  9.       container_mc.attachMovie("Box","Box1",this.getNextHighestDepth());
  10.  
  11.  
  12.       var size = (random(100) + 20);
  13.       var xrand = random(500);
  14.       var yrand = random(500);
  15.       container_mc._height = size;
  16.       container_mc._width = size;
  17.       container_mc._x = xrand;
  18.       container_mc._y = yrand
  19.    }
  20. }
  21.  
On the last frame of the box mc i call another box to be loaded.

Everything works as it is supposed to (a number of boxes are created and placed on the stage with different sizes and positions) Although my code works im sure it could be written better. My main thought is that Each box will have the same instance name "container_mc.B ox1" Also there will be many container_mc made rather than 1 container_mc with many Boxes inside. I have tried moving the statement where i create the container outside of the loop but cannot get anything to appear. Much thanks to anyone would be kind enough to edit my code.
-Shawn
Aug 21 '07 #1
0 908

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3720
by: Daniel Hill | last post by:
OK, I have very, VERY basic background knowledge of VB6 and have now upgraded to VB.NET and now I'm struggling to bring up the forms I want. What I am looking to do is to have a click a command button bring up a form, and to have which form is brought up determined by which item is selected in the accompanying combo box. I've gathered that you have to declare the item as a
4
561
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum number of window handle, because if I reduce to about 2 instances of each window, it can run. But not 20 instances of each window. Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
2
5261
by: Ben | last post by:
My current project requires me to create part of a form that is created on the fly. The project consists a list of entries to an event. The name and address and such is easy. The design is detup so that the creater of the even can make their own event in the database. When they do so a 2 tables are created. One for the entries such as names and the other is for the parameters of each event. The creator then goes in and makes each event...
1
2273
by: James | last post by:
I am creating a system whereby equipment is inspected. Data is inputted into an inspection form. However, any equipment that is not satisfactory needs to have spare parts ordered for that piece of equipment from a list of parts. I kind of need a form which lists parts and then check boxes next to a part can be created so the user can select which parts are needed and then a button is clicked which sends these parts to a report. I am not...
12
3149
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
6
3409
by: BurntWithTime | last post by:
Hello everyone, Please can anyone tell me if it is possible for a VB.NET application to check a database and then create textboxes on a form that correspond to those records on the database? For example, say I had a table in a DB that contained movie subjects: Horror, Sci-Fi, Comedy etc. Would it be possile for the VB app to look at these and then create the text boxes Horror, Sci-Fi and Comedy? Thanks, BWT
2
3265
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly correlated to the combo box selection using SQL. Here is an example from the afterupdate event in the...
1
4885
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have set text boxes and labels inside the table rows. I then added a button. All of these are done through code. The problem that i am having is i can get the value from a text box with resides inside the first panel (out side of panel that is...
3
1468
by: Peter Morris | last post by:
Hi all Let's say I am creating a model to represent classes and properties. In addition to this I need instances of classes and values for those properties. KEY: (AssociationEndName)
0
7992
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8398
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8400
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8267
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
3940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2414
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1505
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.