ActionScript 3.0 :: Identifying The Type Of Child For If Statements?
May 9, 2009
taking the time to look at my query:Essentially I want to know what to replace the 1_mc with.
Code:
var various_mc:MovieClip = new 1_mc;
addChild(various_mc);
[code].....
View 5 Replies
Similar Posts:
Nov 23, 2009
I am creating a selection of checkboxes that are supplied from XML. These checkboxes are to provide additional details to a background picture and therefore they each have a unique name and an eventlistener to add the extra details to the background picture. Depending on other buttons clicked on the stage, the list of checkboxes could change for the same background picture. I have a selection of 5 different background pictures all of which have a different list of checkboxes. I therefore want to load the checkboxes dynamically. When a button is clicked to change the background picture, I want to remove all the checkboxes associated with that picture and display a new set for the new picture.
[Code]...
View 3 Replies
Jun 5, 2009
I have this code, and in the end, where I am trying to removeChild(ball) I get an error:
[Code]...
View 2 Replies
Jul 30, 2009
I want to stop() all MovieClips that are the child of a certain parent.
Code:
for ( var i:Number = 0; i < actor.graphic.numChildren; i++ ){
actor.graphic.getChildAt( i ).stop();
[code]....
View 1 Replies
Feb 2, 2011
so here goes the description of what i'm (trying) to make : i want to make a slideshow with AS 3, it will load external image which the location will be written in xml after it has load all the image it will play by itself and change beetwen image with transition.. well i manage to : read the xml, load the picture one by one and convert it into a bitmap tipeafter convert it to a bitmap tipe data i save it into an arrayafter all the image has been laoded , converted into bitmap and saved into array to display the image itself i first add the the image which has been save into the array to the container that i specially made to hold this (well actually because transition manager can only have effect on MovieClip).
myMCContainer.addChild(myImageArray[imageIndex]); that's how i display it (of course i have added "myMCContainer to the stage").
well the real problem is when i tried to use remove child fo myMCContainer it give me error #2025, and when i tried to check number of child that myMCContainer has it returned 0 even after adding the image...
[Code]...
View 5 Replies
Oct 19, 2009
I have used AS2 for a while but the movie gets very slow when thousands of objects on the stage. I would like to turn to AS3 for better performance. My basic symbol is a MC consists of a button and a text field. Can I change it from Movie Clip to Sprite? I read a document that says "Sprites serve as containers that can be filled with shapes, images or text. "... Could someone tell me if the Sprite can also be the container for button?
View 8 Replies
Apr 26, 2010
I am using loader to load an image "1.jpg" in the constructor.Using a timer, after 5 seconds I want to remove the child and then reload another image however removeChild doesn't work, neither does getChildIndex. In the constructor I can call getChildIndex and it outputs 1, however in the Timerevent function it seems that I cannot get access to the my_loader created in the constructor.
However from the Timerevent function I do have access to the variable test that I created in the constructor. Why is it that I can access test, but not my_loader and how can I fix this so I can get the reference to my_loader within the Timerevent function? I tried moving the loader outside of the constructor but then I get a message saying that my_loader is undefined for the line "my_loader.load(new URLRequest("1.jpg"));"[code]...
View 2 Replies
Jul 23, 2009
I'm working on a game where I'm adding a symbol (an enemy unit) from the Library via addChild() to an instance on the Stage. The symbol has Linkage/Class enabled so I can stick stat variables directly on it for easy access.The problem is that I want to use the same name for enemies (like en0, en1) in different areas, but if I try to removeChild(), I get Error 1067: Implicit coercion of type Class to type DisplayObject.
View 1 Replies
Mar 29, 2011
public var blob:Blob = new Blob()
addChild.child(blob)
i get this error Call to a possibly undefined method child through a reference with static type Function.
View 4 Replies
Oct 7, 2004
If they get a question wrong in my quiz ( weakest link) the money clip goes to zero and it goes onto the next question. If they get it right the money clip advances and they go onto the next question. I want to include each time that it should only go onto the next question if all questions have been asked. SO i want an extra if clause in both sections, saying if current question is more than 11 go to '#game over"The questions are saved in the frame of the quiz
_root.qArray = new Array("question: A;B;C;D")
_root.qArray.push("Question?:A;B; C; D")
There are 11 questions.At the moment at the section with choosing answers I have
function selectAnswer(n) {
// correct
if (answers[n] == correctAnswer) {
_root.money.nextFrame();
[code].....
View 1 Replies
Feb 23, 2007
I have an AS3 application which seems to be leaking memory slowly while running. I've been looking for a profiler for Flex 2 / AS3 and haven't been able to find one yet, in fact I saw posts from people at Adobe saying they were working on it but no release in the short term!
Does anyone have any more news on this, or more usefully have any information on a profiler or other way it is possible to find memory allocation and usage during runtime of an AS3 application? It would really help me to identify what areas of my application are leaking memory.
View 4 Replies
Oct 27, 2009
I am trying to produce an auto check on the synchronizing process between XML values (string based by nature) and object properties.
E.g. if the property on the instance is of
Code:
public var isThere:Boolean
public var anum:Number
the code should know the type and adjust the property value
Code:
isThere = Boolean(xmlValue)
anum = Number(xmlValue)
Its all swell apart from Arrays, which mainly are identified as 'object'.
Anyone know the best check to differ between Array and Object?
View 4 Replies
Feb 28, 2012
I have an xml and it has items, you can trace the items in Flash, but how do I call them to allow me to identify that object getting clicked on the stage?
e.g. Item 1.2- how can I identify it in Flash?
<?xml version="1.0" encoding="UTF-8"?>
<menus>
<menu id="1">
[Code].....
View 2 Replies
Jun 1, 2004
I have 16 layers of movieclips (one in each layer), each has been given the instance name, "line1" through to "line 16". I'm trying to figure out how to hide all of them through actionscript, so far, my code is:
for(x=1; x<17; x++){
line[x]._visible = false;
}
but for some reason, it doesn't hide all the instances. I've tried typing it in seperatly, (line1._visible = false; , line2._visible = false; , etc...) and it works, but for some reason, when I use the for loop, it doesn't work..
View 2 Replies
Apr 11, 2012
I've been scouring the web to see how to do this, and now I'm not even sure it's possible. However, it seems there must be way. What I want to do is create a function that will take x,y coordinates and tell me what MovieClip or Sprite is at that location. I want it to happen automatically, without any MouseEvents or anything like that.
View 8 Replies
Jun 1, 2004
I have 16 layers of movieclips (one in each layer), each has been given the instance name, "line1" through to "line 16". I'm trying to figure out how to hide all of them through actionscript, so far, my code is:
for(x=1; x<17; x++){
line[x]._visible = false;
}
but for some reason, it doesn't hide all the instances. I've tried typing it in seperatly, (line1._visible = false; , line2._visible = false; , etc...) and it works, but for some reason, when I use the for loop, it doesn't work...what am I doing wrong?
View 2 Replies
Jan 15, 2011
I want to identify specific strings in a text box from user input to add to a score variable, like so -
[Code]...
The example given adds 1 to the score, but if a user adds a space then a second word the text box views it as a whole and not individual words, resulting in no values added to the score variable.The problem lies with the whole text box being viewed as one entire string. Instead, I want to split it up so word1 will add 1 to the score, word2 will add 1 to the score, etc.
View 1 Replies
Feb 24, 2011
How can I read the click tags names used by a flash file?
View 1 Replies
Dec 28, 2011
I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.
function doSomething(someArg:Object):void {
if (conditionIsFalse){
operationsToDoWhenConditionIsTrue.push(function(){
doSomething(someArg);
[Code]...
Basically if doSomething is called twice, I only want operationsToDoWhenConditionIsTrue to hold the most recent invocation. Obviously since the invocations are wrapped in function(){} all the functions are the same. Is there any way I can accomplish what I want?
View 1 Replies
Feb 4, 2009
How do I determine what objects are underneath a given x or y coordinate on the stage or within a sprite? Preferably, I'd like to be able to do this so that a class that extends Sprite and is a child of the Stage can determine what's underneath a given x coordinate of itself, regardless of position on the stage. This has to be done without user input.
I'm not clear on what methods might make sense for this. The hitTest stuff requires more info than I'm likely to have. Maybe localToGlobal, but to use that, I need to know what the objects are already. There are a finite number of them, so I could have them testing for this all the time, but that doesn't seem right and may not even get me what I'm looking for.
View 3 Replies
Dec 9, 2009
I have several array element each assigned to different symbols on the stage and now I have assigned one function (fcn1) for each element's MOUSE_OVER event as follows:.
for(h = 0; h < fields.length; h++)
{
fields[h].addEventListener(MouseEvent.MOUSE_OVER, fcn1);
[code]....
Now in fcn1, I have to identify which element the mouse was over it. I could not do this because I can't pass any parameter to fcn1 other than e:MouseEvent. And I tried to look the properties and methods of e:MouseEvent that might give any information about the source element (in this case, array elements).So far, only way out of this was I create function for each array element which in turn call fcn1 with appropriate parameter, but it is cluttery.
View 1 Replies
Mar 13, 2008
how can i find (possibly with flash ) the listing of sub properties for events?i would not know if sub properties even exist for an event if i'd not done a tutorial stating so.for example.
var listenerObject:Object = new Object();
listenObject.cuePoint = function(evtObj){
trace(evtObj.info.name); //how do i find out if such sub properties exists for events?
[code]....
View 3 Replies
Jul 13, 2011
I have an html text being brought in from XML to a dynamic text field. The html text has a <br> in it. I need an If statement that can detect if the text has the "<br>" in it or now. How do I do that?
View 8 Replies
Sep 30, 2009
I'm working on a pretty simple game similar to Pingu Throw involving hitting an egg as far as possible. It uses very basics physics and involves a bit of moving some movieclips with bitmaps inside around to simulate a parallax background. For some reason, if you hit the ball at a certain angle, the whole thing slows down horribly (ironically, the slower the ball moves, the bigger the drop in frame rate).
I have no idea why this is occurring and have taken the following steps to rectify the problem with no success:
- tried 'cache as bitmap' both on and off for all the assets.
- disabled all non-necessary objects and methods.
- made sure assets are optimised and of an appropriate size.
I just cant get rid of the slow down without removing the code that is used to scroll the game sideways (pretty essential to the game). I need to get this game done ASAP. Here's a link to a .zip of the files. You'll need TweenMax in your classpath.
[URL]
View 2 Replies
Jun 27, 2009
Over the past years I have created many different .fla's of aircraft panels( ie. hydraulic panel, electrical panel, pressurization panel, etc.) Each .fla has only one panel in it. Each panel is a movieclip and made up of movieclips, graphics, etc. It has it's own code built in and the idea was to be able to copy the panel from the original .fla to a new .fla, that contained other panels, and together would become part of a training program for the company. No I wasn't smart enough to uniquely name each asset(switch, guage, light, etc.). I did avoid the default names like symbol1, symbol2, etc.
Now I need to take each of the panels from the individual .fla's and put them into one larger .fla to act as a single library for all the panels. This single .fla will become the master Library that I will link all future .fla's to. As you would guess I get the "One or more library items already exist in the document:" message when I try to copy and paste a panel(movieclip) into the new .fla.
Question:Is there an easy way to identify specifically which items are in conflict without having to do a direct comparison between each of the libraries?
View 5 Replies
Jan 12, 2011
how to identify which marker overlay is being clicked.
I've looked up solutions online and the only thing that ever traces back for me is [object Marker] I need a way to identify the marker icon and manipulate the icon.
this is the marker code:
ActionScript Code:
function createMarker(latlng:LatLng, number:Number, tip, myTitle, myContent):Marker {
trace(this);
[Code]....
View 1 Replies
Mar 25, 2009
I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage
View 2 Replies
Dec 6, 2010
I get the error message. Doing like tuts said. package { import flash.events.*; // rememeber to import all flash libraries or the ERROR will come up with "TYPE" does not exist etc.
[Code]...
View 4 Replies
Dec 24, 2010
[Code]....
I'm basically having the following error: 1067: Implicit coercion of a value of type void to an unrelated type Array. In relation to the event listener that calls 'Backdrop'. Backdrop is a public function in another class, but it does still recognise Backdrop as a function.
View 13 Replies
Nov 2, 2011
im making a game and i have occured a problem.i have a hits text on the screen and every time a enemys bullet hits me it decrases by 1.and i wanna make that when it gets to 0 my ship explodes.
package com.asgamer.basics1
{
import flash.display.MovieClip;[code]............
i get this error 1067: Implicit coercion of a value of type int to an unrelated type String.
View 3 Replies