ActionScript 3.0 :: Working With Lots Of Movieclips At The Same Time?
May 14, 2010
I'm a game developer and I have been (trying) to optimize an engine I'm making for my game. So far I have done almost every code trick there is (almost, because I'm not even close to be a professional programmer so I don't know how to do this perfectly )The game is working very smoothly now, I'm impressed, but its still generating some issues with MovieClips. When I load a new map, it loads up a movieclip that contains all the ingame objects (Screen). Inside, I add all the enemies, player and map elements I need. After that, I sort the index of the objects inside it by their position on Y.
While this works fine (using vector), my problem is that each map has like 30-40 movieclips (like doors, walls, etc), plus the player (another movieclip), plus some objects (20-30 movieclips), plus some enemies (10-40) movieclips... and when I move the camera (following the player), all the flash window area needs to refresh, and generates lag. If I only have the doors, walls and player, it runs ok... but when I start adding the enemies and other objects... Is there any efficient way to work with movieclips? Notice 90% of map elements like doors and walls are a movieclip with only one frame.
View 1 Replies
Similar Posts:
Aug 11, 2009
Is there a way to make many movieclips change the same way, off the same line of code.. rather than having to write them all out seperatly?
eg.
If this was the original code...
clip1_mc.onRollOver = function () {
clip2_mc._visible = false;
clip3_mc._visible = false;
[Code]....
The above doesn't work... but i'm wondering if anyone knows of a method that will work... saving me from having to write so much code in future?
View 3 Replies
Dec 23, 2008
I am in the making of a isometric level editor, and I have about 15 movie clips with more to come. I want to let people change the color of tiles to what they want from a list of colors, so how can I let them change the color of a tile dinamicly with actionscript so that it changes a tile's color while preserving changes of "shadows"? I mean I have let's say a cube and to make it look 3D I need to change each face to make a feeling of 3D and not a flat one.
View 1 Replies
Apr 5, 2004
I want to load a external movie (swf) into my current movie. My syntax:
loadMovie("movies/"+itemName+".swf","_root.popup.popup_bg.movieName" );
loadVariables("content/"+itemName+".txt","_root");[code]....
First line: Loading the movie into the instance
Second line: Loading some vars into my scene
third line: make the popup appear with an alpha tween
fourth line: proving the itemName is correct.
Problem: First time running this script results in not showing my movieclip
Second time running this script everything works perfect.why my movie is not loading?
View 3 Replies
Apr 5, 2004
I want to load a external movie (swf) into my current movie. My syntax:
loadMovie("movies/"+itemName+".swf","_root.popup.popup_bg.movieName" );
loadVariables("content/"+itemName+".txt","_root");
_root.popup.gotoAndPlay(2);
trace(_root.popup.popup_bg.movieName._y);
First line: Loading the movie into the instance Second line: Loading some vars into my scene third line: make the popup appear with an alpha tween fourth line: proving the itemName is correct.
Problem: First time running this script results in not showing my movieclip Second time running this script everything works perfect.
View 3 Replies
Aug 28, 2009
Suppose I have movie clips named mc1,mc2,mc3,mc4... In as2[code]...
View 1 Replies
Dec 16, 2009
Every 5 minutes, a new movieclip should be loaded.These movieclips show a message 'still 20 min to go', 'still 15 min to go', ...
The project should start by a button in the first movieclip.
View 2 Replies
Aug 24, 2009
Currently I have a function that makes a movieclip copied from one specified in the GUI,moves it to a certain point on the stage, then ends. This is called several times to create various patterns etc on the stage.
Code shown below:Code:
function draw_block( iX, iY , sBlockName )
{
[code]....
View 11 Replies
Oct 25, 2005
I download a tutorial to make a digital clock now what I want to do is make my movieclips go to a different frame depending of the hour. I want to make that effect of day/night.
View 6 Replies
Aug 1, 2003
The following actionscript is some that I got from lostinbeta from an alpha fade question I had, that works fine but I now would like to have the movieclips get smaller at the same time as fading. So I put in some code that went like this
[AS]
//set the transform
mc._xscale = (i*10);
mc._yscale = (i*10);
[Code]...
View 14 Replies
Apr 14, 2011
I have around 400 sounds in my flash file.Is there anyway to go about using them with having to instantiate them all.I will be storing them in an array.
var sound1:Sound = snd1;
var soundN:Sound = sndn;
var mySounds:Array =[sound1,soundN....];
I already have linkages in the library as sound1,soundN,etc
View 1 Replies
Aug 21, 2003
How would one go about this ?say you have a number of input text fields. and ppl feed their orders in.
big mac = 5
mc chicken = 2
lg coke = 0
fillet of fish = 0
cookies = 0
sunday = 2
then once they are done it shows thier order..... without all the menu items.
big mac = 5
mc chicken = 2
sunday = 2
To do this I was going to attempt to have an if statement for each item.if there was an item ordered a dynamic text box would be created at _x _y...... then add 10 to _x. (to move the next one down the stage)
if there was no item ordered a dynamic text box would not created.then the next item would be created further down the page as _x was increased with the last menu item created.
View 7 Replies
Jun 17, 2010
I am using the following code to simulate a volume control bar filling on vol+ and unfilling on vol-. The dragger is a mask that causes the fill to appear and disappear when the mouse is pressed and dragged on the volume controller. It works well, but I would like to add a "switch" that moves at the same time and in the same location as the fill, but on top of it... I created the movieClip for the switch and tried all kinds of variations to the following code with its instance in the code, but cant seem to get it working... below is the code which works with just the mask filling / unfilling.
this.ratio = 0;dragger.onPress = function() {this.startDrag(true, 0, 0, line._width, 0);
this.onEnterFrame = function() {
ratio = Math.round(this._x*100/line._width);
_root.volume = ratio; }; };
dragger.onRelease = dragger.onRelease=stopDrag;
View 3 Replies
Sep 4, 2007
I have a problem when few movieclips calls the same function, every movie clip when it is onMouseOver give to the function their properties witch function process.
If i OnMouseOver a few movieclips at the time the function cant calculate every movieclip alone... Maybe i have to put some array.. ??? i dont know..
On OnMouseOver the movieclips move i random direction and when i passes 15 seconds they return to their original place..
View 5 Replies
Nov 20, 2010
I have made a for loop that makes lots of squares by making a fresh graphics object for each square:[code]Is there a better way to do it as this seems to cause massive slowdown as the game gets larger.Like if I use something from the library, I can just reuse it without making it every time (like = new telephone() ).Its like it reuses the image in each instance of the object.But is it possible to reuse in this way with shapes?
View 3 Replies
Jan 8, 2007
Only recently have I understood that onEnterFrame creates a continuously-running program that runs at the same framerate as the movie (until you call a "delete enterFrame). So, if I have a bunch of these running at the same time will I see a big speed drop? I'm a bit leery about using onEnterFrame because of this. Are there any alternatives to this method? I haven't been able to find any (short of putting onClipEvent handlers on movie clips).
View 5 Replies
Apr 23, 2010
I am using FlashDevelop and Flex SDK, I use this to embed things on the swf:[code]Now, I would like to embed more than 100 files (or maybe more!), and doing this one bye one will take long and will be very exhausting Is there any easy way to that easily?
View 1 Replies
Jul 22, 2010
We have made a simple button class that extends MovieClip, the purpose of which is to allow animated switching between lots of states. So far so good. Then we extended the simple button again to allow for a text field and resizing hit area. Still all good. Finally we extend our label button into an application specific type that alters the button's background image in a certain way. Everything seems pretty simple, right?
Now for the problem: it doesn't perform any gotoAndPlay actions.It should be jumping to labeled frames, the traces of the target labels come out correct, but the playhead never moves. Looking at the application using De Monster, it seems that each instance of the button is missing all the properties and methods of a MovieClip.I realise that this is all a bit vague without showing any code,what might cause the debugger to report a lack of properties or why gotoAndPlay might be blocked
View 5 Replies
Jul 18, 2010
I have a movie clip who is only a square, i need to copy it on the flash stage a number of times (dinamic). How can i do this in execution time, i know AS2, so i prefer a solution in AS2.
View 2 Replies
Feb 24, 2009
URL...My question is how can i make the movieclips that act as buttons play a certain frame on my time line? ....i don't know where or what to insert.
View 1 Replies
May 14, 2009
I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.< What I'm doing is
PHP Code:
addChild(movieclips[0]);
but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me .How do I add the selected movieclip out of my array?
View 4 Replies
Jul 9, 2009
I have several movieclips in my project which are being used as buttons, and when you rollover the mc's the content is viewable the entire time the mouse is hovering in the area of the movie clip, once the mouse moves off it disapeers. Great. I have the code that allows this to happen, but i have multiple mc's and only one works at a time. Here is the code:
mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
mc.gotoAndStop(2);
[code].....
View 2 Replies
May 25, 2009
I have 9 movieclips, and 9 buttons. (mc1, mc2, mc3.... & btn1, btn2, btn3...)
I'd like it so that when you rollover the button, the corresponding movieclip begins an animation.
I thought I was on the right tracks here:
Code:
for (var i:int = 0; i < 8; i++) {
this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, onButtonOver);
this["btn"+i].addEventListener(MouseEvent.MOUSE_OUT, onButtonOut);
this["btn"+i].addEventListener(MouseEvent.CLICK, onButtonClicked);
[Code].....
I just can't seem to direct a tween to a corresponding movieclip dynamically.
View 2 Replies
Jul 30, 2004
I have a movie that has a movieclip containing some buttons in it. The buttons when pressed call up another movieclip within the movie the buttons reside. When viewed though the movieclip the button activate doesn't play? although when the scene is viewed within the movieclip the buttons reside the movieclip does play?
View 1 Replies
Jan 8, 2010
I'm having a hell of a time optimizing my loading sequence for a gallery site I'm working on. This is the way it works:
1. I load and parse an XML containing the URLs to the thumbs and large versions of the photos. - This step is fast and works the way I want.
2. I load the thumbnails in sequence jumping back and forth between two functions - one initiating loading of a thumb, and the other the event handler for that particular thumb which iterates a value, and then calls the initiating function again. I suspect this is where the major slow down happens.
3. When the iterating value has reached the same number as the number of URLs to load, the class dispatches a complete event, and all is well - except so much time has passed that no one will ever have waited to see the content ...
[Code]...
View 7 Replies
Apr 18, 2010
I'm trying to get the program to generate a library object called "Enemy" on the screen when the conditions are met.
Here's the bit of the code which is causing me problems:
Code:
var army:Array;
var enemy:Enemy;
function AvoiderGame()
{
[Code].....
I'm sure it must be a simple error, I can get the logic working when it just traces something on the screen but i can't get it to generate an "enemy"
View 4 Replies
Apr 16, 2011
I'm doing an AS2 project with a parent.swf that loads many child_##.swf's. they each use identical buttons and other library assets.tried using Shared Library concept two different ways:
1 - created library.swf and used assets from it for child swf's ... no problem when child is played by itself, but when parent loads the child's, shared assets do not work,
2- established parent.swf as the 'library', and followed the common steps of Shared Library setup, but shared assets did not work. of course, using class files works, but still I need a central place for the graphics ( I'm avoiding having my classes create graphics via draw methods ).
View 1 Replies
Aug 24, 2009
I hired flash developer to make me fisheye menu with a lot of rows and columns, be he just can't make it, he says that it stuck and that it is slow when he tries to make a lots of rows and columns, is there any component in flash that could work with to make that.
View 2 Replies
Oct 19, 2010
I am running into trouble with a multidimensional array. This works well with up to about 2000 "sets"
var datasets:Array = new Array(
// one "set"
new Array(
[code]......
View 4 Replies
Aug 19, 2011
I want to create an array of loaded xml for the following:
ActionScript Code:
var xmlQuestions:XML = new XML();
System.useCodepage = true;
[Code].....
What I want to achieve is so I can load 5 different xmls and place them into an array. All 5 random xmls will be placed in an array then I wish to trace them
View 3 Replies