ActionScript 2.0 :: Creates Various Types Of MC
Oct 16, 2007
I want to create a function that creates various types of MC. Lets say so:
[Code]....
Explanation: Create function that creates MovieClip, make for statment to create more Mc with that function.
View 5 Replies
Similar Posts:
Jan 24, 2012
Consider the following function:
Code:
public function foo(bar1:int, bar2:uint, bar3:String, bar4:Boolean):void{}
What I want is to have the different types of data represented by custom named types which are essentially representing the original data types. I other word, I would like to proxy the data types and have a valid function as following:
Code:
public function foo(bar1:PAR_Bar1, bar2:PAR_Bar2, bar3:PAR_Bar3, bar4:PAR_Bar4):void{}
so PAR_Bar1 would proxy the `int` data type, PAR_Bar2 would proxy the `uint` data type, so on and so forth.
The reason I need this is because I'm using a debugger with a GUI that can run methods and allows changing function parameter values in real-time, the issue is that the debugger can't tell me what parameter I'm changing, it only displays the data type of a parameter. So if I need to change 10 different parameters all of type int, the debuggers display all of them as int and not by their names.
I think that if I use proxy types I can easily differentiate between parameters.
So, my question: Is it possible to proxy data types? I mean map specific data types to custom data types that would represent the base data types?
View 2 Replies
Apr 27, 2007
i'm wanting to create mc's dynamically depending on how many images are listed in my xml file...so if were to edit the xml file and add more images to it my website would add more movieclips...
View 14 Replies
Jul 20, 2009
I have some code that does what I need it to do, but I need a way to differentiate between the mc's it creates.Here is the code:
_________________________________________________
TL = this;
str1 = ["strandA","strandT","strandC","strandG"];[code]....
It generates mc's randomly.So for instance, there might be 3 "strandT" mc's on the stage at the same time.How could I tell them apart? If, for example,I wanted to say, make the first "strandT" disappear, but not the second and third.
View 2 Replies
Feb 15, 2011
I have a question regarding createEmptyMovieClip in AS2. I have a flash file separated out into sections with labels and menu buttons which allow you to move you to the relevant frame/section (which contains the information/contents relevant to that section). This works fine. What I can't work out is that if I manually put a movieclip on the stage in my 'about section' and then add contents to it via AS2 then it only exists within the about us section. If I do it using createEmptyMovieClip within the actions for the about frame this works fine but it then always exists on every other frame of the project. I assume this is because it isn't actually creating it within this frame but I can't work out how to make it do this, even when i use this.createEmptyMovieClip it has exactly the same effect. I can obviously remove the movieclip completely each time a user moves to another frame that doesn't contain it but I don't want to do this as it contains a youtube video and leaving it means it doesn't have to be reloaded each time they come back.
I would be massively grateful if anyone could shed any light on this for me as I know i'm not getting how to place it correctly but i'm not sure how I should be doing it?
View 1 Replies
Oct 10, 2011
I'm using Flash Builder 4.5 to create what's needs to be a single SWF project, and I'm running into issues with allowing the main SWF to preload itself.I know about using the meta factoryClass to allow for this kind of preloading, but every time I publish I'm now seeing it create a new SWF for the preloader class as well as the main class.I swear I've used this approach in the past and never had the second file. Is this no longer the way to be doing things? Would you suggest an alternative, or is there a simple fix?[code]
View 1 Replies
Apr 19, 2005
I have an array that creates 7 mc clips with names.I'm trying to make each one of those peices clickable.When clicked each peice will slide over to the far left "barrier_mc" and stop.Actually not true, the one closest to the "barrier_mc" will stop at the barrier and from then on each piece will stop when it hits the one beside it (kinda like a 7 car fender-bender). This isnt the problem im trying to work through right now, although i will in the near future.
What im trying to figure out is the array that creates the mc's names them like the following "" infoBar"+i+"_mc"". What im trying to do is call that in a function so that i dont have to type in each of the 7 mc names manual I.E (infoBar0_mc) you'll see my function at the bottem in the "function pieceStop"of the pasted code.
Code:
var list:Array = ["piece1", "piece2", "piece3", "piece4", "piece5", "piece6", "piece7"];
var startingX:Number = list_mc._x;
var bottom:Number = 950;[code].....
View 2 Replies
Apr 23, 2010
I have this code + background color set to grey. The weirdest thing is that addChild(something); seems to create a white 46x46 pixel white box on stage. If I take addChild away, white box goes away as well..
Timeline script:
Code:
var something:Main = new Main();
addChild (something);
Main.as:
[Code]....
View 1 Replies
Oct 8, 2009
I am having an issue with some code I found for a custom cursor.
Code:
import flash.ui.Mouse;
Mouse.hide();
function init()
{
Mouse.hide();
View 8 Replies
Jun 11, 2011
I'm having problems with deleting what a variable creates on stage!I have a random image loader as seen below.This creates a random image from the list I give it (only 4 in this example) and puts that picture on the stage.[code]Depending on the image the right or left door is the correct door (tr is the left doors name).The code below works fine, it even inserts the _whatPicture randomly again but the problem is the new picture overlaps the old picture, I can't figure out what to type so it will delete / remove the first _image, so that the new image is the only one there.[code]
View 4 Replies
Feb 11, 2011
I load images into my .xfl project and use them amond movie clips - everything is ok at beginning. But after a some moment (which is absolutely undefined) Flash Professional CS5 starts duplicating all of them at saving and new copies names with "Copy 1", "Copy 2" and so one, or just with blank string. Because Flash duplicates them EACH saving, so after a several savings Flash refuse to save at all (shows "Too big project ..." error).
View 7 Replies
Jul 15, 2011
I was working on some blitting code today and after profiling it found that I was creating 1000s of new rectangles. I was shocked because I only had 1 or 2 different new Rectangle() calls or I was using the .rect property of BitmapData.
I started commenting out huge swathes of code until I was left with this code in my sprite class:
canvas.bitmapData.copyPixels(_bitmapData, _bitmapData.rect, destination, null, null, true);
I cached the result of _bitmapData.rect at object creation and my thousand of new rectangle calls were suddenly gone from the profiler.
Why the heck would BitmapData.rect create a new rectangle? Is there a way to check the core libraries or something and confirm this is true?
View 4 Replies
Oct 10, 2008
. As far as I could see in the reference manuals, the beginFill() method of the flash.display.Graphics class ends any previous incomplete (i.e., not ending back at the start point) fills by automatically drawing a line to the latest MoveTo() location.But, it seems it also ends any previous incomplete drawing even without fills, by drawing that final line.
But that's ok. The weird part is, even when I draw just one line and begin a fill immediately after that, I guess it tries to complete that line by drawing one more line back to the starting point and the messes up the display with the fill color in the following beginFill() call.
public class MyContainer extends Container
{
public function MyContainer()
{
[code]....
The output is as in the attachment.The first part creates a weird fill along the side of the line till the end of the container object.I even tried a endFill() at line 4, but same result. The only way to prevent this is to explicitly moving to some point as in line 11.
View 0 Replies
Nov 23, 2009
I've just started working with sound and as I understand it I primarily need two objects: Sound and SoundChannel. Every call to a Sound.play() method will create a new SoundChannel object. So technically, I could write my code like this:
Code:
package
{
import flash.media.Sound;
[code]....
Will simply create a new SoundChannel object and the first one created by the constructor will be garbage collected? As a side note, it's possible to see Adobe's source files e.g.SoundChannel.as. I'm curious as to how the SoundChannel.stop() method works since it doesn't throw an error or exception even if the audio has already stopped playing.
View 3 Replies
Apr 21, 2010
Fla is attached (small file, simple function)I am going thrue an array and create instances of 'inputter'.It all works fine for the last one in the array but not the first ones.Shortening the array-count still creates only the last one and not the first ones.
My function:
ActionScript Code:
doinit = function()
[code].....
View 1 Replies
Mar 18, 2011
ActionScript Code:
private function drawMap(tile1:DisplayObject, tile2:DisplayObject):void
{
var _tile1 = tile1;
[Code].....
The idea behind this is to store custom sprites in an array and then feed the array to the drawMap function, which would use the sprites from the array to draw a map.
View 1 Replies
Dec 11, 2007
i got an xml fed into flash that creates multiple icons. When icon is clicked it will load an external swf into a container. I am having issues with this part:
Here is question
Why does this work in a test file:
myContainer._lockroot = true;
myContainer.loadMovie("movie.swf");
xml:
myContainer._lockroot = true;
myContainer.loadMovie(this.link);
this.link refers to location of swf file that is related to the icon pressed in xml.Everything works fine and dandy however here is the trouble, they all have different parameters and when loaded into another container thus in a swf they lose some of these. However in my test file when it is simple and straight just 2 lines of code (see above) everything works.
View 2 Replies
Aug 9, 2011
I am trying to get this simple logic to work correctly. Right now, the trace is:
int 0
int 0
int 0
[code].....
View 2 Replies
Mar 27, 2011
Has anyone seen a Flash Component that creates a slide transition similar to this [URL]. Looks like there is a looping background image and the other slides are loaded above it (hopefully via XML?) and the transition effect maybe in a component???
View 1 Replies
Nov 17, 2009
I am working with a Flex DateTimeAxis. I have a scenario where the DateTimeAxis sometimes creates duplicate months on the Axis. The month label unit is generated based on a min/max value that is supplied to the DateTimeAxis, it is NOT generated by the series data as far as I can tell. In other words, the duplication does not exist within the data supplied to the chart, but is part of automatic label generation process that DateTimeAxis will execute when supplying a min/max value for the axis.[code]...
View 1 Replies
Jul 15, 2010
I'm doing a basic reflection class that will take any MovieClip, create a copy (using BitmapData), and do the flipping, alpha, gradient mask, etc to create a nice reflection.The class works great, with the exception of dynamic text.I've done quite a bit of searching, and I realize that you must put the TextField into a MovieClip and then take the BitmapData of the MovieClip.
Sounds great... but when I actually do this, the BitmapData that is display on the screen is a box (like a bounding rectangle around the text) that is filled with white.
Other relevant info:
1.) The TextField has embedFonts = true;
View 4 Replies
Jun 20, 2011
I'm trying to create a game and I'm new to actionscript. I'm using actionscript 3.0 and flash player 9. I'm trying to have a button that when clicked creates an object that follows the mouse around the screen until that object is placed on the screen. When I click the button the object follows the mouse but it ends up covering the screen with the objects drag.
View 4 Replies
Apr 8, 2009
I'm using swfaddress which creates a page title in the browser based on what page your on in the flash site. The title comes from the name of a frame label. For example i have a frame label called "About Us" I've capitalised it and put a space between the words because this text is what's used in the page title on the browser and i want it to look good and to be able to be read properly.When the page is refreshed it comes up as: "about%20us" as the page title on the browser.
View 3 Replies
Jun 22, 2010
when using a timer to fade volume, I get clicks and pops in the sound.The fade goes from 1 to 0 in 30 ms. Is there any way around this? Could it have something to do with the fla file's frame per second? This is set at 100.The fader timer is inside another timer (which varies from 150 to 1000 ms)
View 2 Replies
Apr 22, 2007
I have some code below which creates a background and buttons for a basic website. The site consists of 8 sections, with photos, text, etc.I am trying to "_Alpha" fade the entire page upon page Load. I want each page to have the "_Alpha" effect. So I need a function or a correct call to place on each page's code.For some reason, my code below works for the entire page and one button, but the rest of the buttons, still show up instantly. Notice a few lines below where I actually do my tween call, "//Alpha Ease-In". I am using "this" for my tween, but I have tried "_root", and even each button "_root.but1", etc. but it still seems to give me partial results. Anyone know how to correctly tween the entire page upon load?[code]
View 2 Replies
Feb 17, 2009
when I do linkage on a symbol and export it for AS3. Then I edit the symbol, for instance go in and modify anything inside, a shape, etc... the next time I try to publish flash, i get an error multiple constructor definitions found. constructor may not be defined in <Script/> code.I think may be it's because flash does not remember to delete the previous export and creates another one. The only way to resolve this, is to delete the entire symbol and re-create it.
View 1 Replies
Mar 28, 2009
I have to create a function that creates an array of arrays. I have to be able to add elements to the array, delete elements and extract elements? the elements will be arrays. How to I do that, or it is possible?
View 8 Replies
Oct 7, 2009
I have linked a MovieClip to a class. After that I have places some movie clips of them on the stage. And now I like to do something with them, but I couldn't because some extra instances are created (I wonder how???) and they make me problems.The names of instances of the class I placed on the Stage are legs1 legs2 legs3,and the extra instances are: instance21, instance25,...(and they are not visible on the Scene)
View 2 Replies
Sep 15, 2010
If an object, or say... a document class, creates an instance of a class (and stores it as a variable), and it doesn't pass any arguments to the constructor of the class, can that class object, by simply having a function of it called by the parent, tell who sent it that command/request?
In other words, can a class object know who called it (such as it's parent) via a (seemingly) anonymous call?
View 1 Replies
Feb 9, 2011
I keep confusing myself :S I've been staring at this screen too long.I'm trying to build function that creates a 2D array similar to this one:
Code:
private var test:Array = new Array
(
[code].....
View 2 Replies