ActionScript 3.0 :: Cast String As MovieClip When MovieClip Is On Stage?
Jan 15, 2010I am trying to cast a String (from an array of strings generated by a for loop) which is referencing a MovieClip already on the stage.
[Code]...
I am trying to cast a String (from an array of strings generated by a for loop) which is referencing a MovieClip already on the stage.
[Code]...
I have the code the following code:
in root frame I:
var prevSec:*;
var currentSec:*;
var lastPage:String = "Default/Index";
[Code]....
And it's not working ("canno't create property visible on String"). I understand that if finds the variable to be of String type.
What i need to do is based on the switch to set a certain movieclip to go visible false or true on frame 16. I need to know how to cast the String into MovieClip.
i'm trying to cast a MovieClip to a custom Class that extends MovieClip called MovieClipExt
ActionScript Code:
package {
import flash.display.MovieClip;
[Code]....
...but sadly returns null instead of a MovieClip converted to MovieClipExt
what should i change to make this work?
I want to have a loader function that passes the loaded data to the correct function. So I can do this:[code]Is there any way to type the second variable to avoid the clumsy switch routine, like so:Function (sendTo) ();
View 2 Replieswhat I'm trying to do is accessingsnapText = scrollPane.source.textSnapshot;from an external swf. I've tried:
trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));
[code].....
I have the scenario below. I have a movieclip on the stage (root). Inside this movieclip I have a frame with the action below:
_root.MCHappy.visible = false;
_root.MCSad.visible = false;
_root.MCNormal.visible = true;
I cant get this working with AS3. How is the correct way to do that inside a MovieClip with AS3?
I am making a site and have a component on the stage that is put there dynamicly through AS 2.0. When I F5 or Ctrl F5 it seems that the actionscript is read allover again?Only the script that is situated in the specific label. What if I have script in that label that creates a news reader. I f12 and the news reader is there I jump to another label with the menu. when i jump back to the home label the news reader does not appear on the stage. after a f5 or ctrl f5 it does.Do I have to attach the movieClip in each label to assure a the dynm-movieClip script is on stage for the ctrl f5 issue?
View 0 Repliesknow how I can resize the stage to match the size of an external graphic/movieclip which is loaded into an empty movieclip,
View 3 RepliesDoes anyone know how to cast a string into a uint?[code]...
But i keep getting an error stating that there is a mismatch in variable types or i get a value of '65280' when I trace myUint.I understand that uint is a positive integer but i need to accept a string for the colour value and need to convert it to a string for use.
i have a list of items that get returned from a database. the list is composed of strings. what i need to do is convert each item into a variable so that i can use each item as an array.
for instance, my array will look something like this: deviceArray = ["osx106", "osx107", "winxp", "win7"];
what i want to do is turn each item into its own array. in AS2 (iirc) we had an eval() method. that is no longer supported in AS3.
I have 5 different arrays for a bunch of excercises, like so:
const oef1:Array = ["citroen","schoen","boek"];
const oef2:Array = ["huis","muis","jas"];
const oef3:Array = ["boek","koek","sok"];
const oef4:Array = ["ei","bij","bot"];
const oef5:Array = ["vier","mier","muur"];
Now I want to set the current game. I do this by copying the array, like so:
var curArr:Array;
var curExc:int = 1;
curArr = ("oef" + curExc) as Array;
I can't convince flash to accept the string ("oef"+curExc) as an Array. How do I do this?
I have searched Stack Overflow extensively but I think I simply don't know the correct lingo for what I'm looking for. It's the only possible reason I can think of why I can't find the answer here because I'm sure someone must have already tried this.
I have a variable in flash:[code]I then have a multidimensional array which has this variable name in it, but as a string.[code]What I need to do is be able to reference the string item in the array, but then cast it so that when I add a number to it the ACTUAL variable with the same name will be altered - anyone know how I can do this?For reasons I won't go into I can't pass it straight into the variable, it has to go through the multidimensional array item.
View 5 RepliesI have 52 symbols in my library each with class names Symbol1, Symbol2, Symbol3, etc. I want to create an array of these classes which will be used to create a random particle effect. How do I cast the var cardNumbers so that the array looks like this[code]...
View 1 RepliesI need to add values in a string (they're strings because I get a date as timestamp from a database and then pluck it apart in Flash with substring). Flash doesn't do math with strings. So is there a way to cast the string into an integer value?
View 4 RepliesI have a movieclip on the stage(lets call that selection movieclip) that once a button is clicked is going to open another movieclip(call this slideshow) I am trying to remove the selection movieclip when you launch the slideshow movieclip.
Error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at mc_work/clickHandler3()
[Code]...
how to load a movieclip into a blank movie clip all in the same movie?!
View 4 RepliesOn the stage I have a movieclip called mc_back. I also have a movieclip on the stage called mc_content. Now, inside mc_content I have a bunch of code and some of it adds, or should add, an EventListener to mc_back as well as a a function that works when mc_back is pressed.
So basically, all code is written inside mc_content and some of it needs to interact with mc_back.
how to target mc_back from inside mc_content. Using stage.mc_back or root.mc_back doesn't work and Google should be my friend, but in this particular problem, it's acting more like my enemy.
how to cal movieclip from stage to the movielcip which present in another movieclip
View 4 RepliesHow do you align a dynamic movie clip position with another movie clip which is in the root stage? I tried to get the mc in root x,y position, but the starting point of the class that loads the dynamic MC does not seems to be accurate. (Meaning at the root stage, the x,y is 0,0 but at the dynamic class, its somewhere like 100,20 for the browser area (and it actually vary base on the browser size))
**the other classes I used to run the custom classes below, I have it added this MC to stage
var blocker:stageBlocker=new stageBlocker();
this.stage.addChild(blocker);
Below is the dynamic MC. Should I not add it to its own "stage"?
public class stageBlocker extends MovieClip {
private var blocker:MovieClip= new MovieClip();
public function stageBlocker():void {
[Code].....
i'm trying to modify a image, which is casted from a String:[code]In the inactiveElements Array are a bunch of ImageIds (way_0, way_1,..) and i'm trying to set the alpha-value of each Image.[code]with the trace i got the right String of ImageId but the cast to Image fails.[code]
View 1 Replies[code]How to set focus to class1_txt?I've tried this, but doesnt work. How to type cast it so that the focus goes to the class1_txt.[code]
View 5 RepliesI'm using as3corelib to decode/encode JSON strings. In my little experiment I want to encode an object (UserInfo) to JSON string and decode it back to the object, however it seems to fail at the convertion point (the last line), why would that happen? how can I make it work?
The UserInfo class
public class UserInfo
{
public var levelProgress : int;
}
[Code]....
just learning as3 for flex. i am trying to do this:
var someNumber:String = "10150125903517628"; //this is the actual number i noticed the issue with
var result:String = String(Number(someNumber) + 1);
I've tried different ways of putting the expression together and no matter what i seem to do the result is always equal to 10150125903517628 rather than 10150125903517629.
How can i attach a movieClip into another movieClip that is already on the stage (using the attachMovie method) and randomly place them.
View 6 RepliesWe're making a simple input text comparisons vs. some constant floating point numbers (e.g. 4.35). Using Actionscript 2 to Flash 9 export. Getting totally contradictory traces on two different computers compiling identical code...Here's some simple code we're using to figure out what's going on.
Code:
trace(typeof(Number(435/100)))
trace(typeof(Number(435/100)==4.35))
trace((Number(435/100)==4.35))
[code]....
Also, what behavior do any PC users have? I'm expecting the latter since they're generally intel chipsets too?Note: once i compile the code on my PPC mac, intel macs that run the SWF (but don't recompile the FLA) do return the correct booleans that match the PPC output.
I have a Movieclip on stage with nested movieclips inside. All referenced at 0,0. None of the child movieclips load any dynamic content, animate or have Masked Layers. It does have an input textfield in one of the child MCs. The parent MC shows 280 px width, while it returns 313 px with a .width trace. There is no code that alters the .width value of the parent MC at run-time. And the ParentMC on stage is not scaled (it is at 100% width/height)
View 1 RepliesHow do you make a movieclip move horizontally from the start of the stage to 3/4 of the stage. Stage size is 700 px by 600 px i want just one row in the middle of the stage. i want that movieclip to disappear right after it reach the end of the 3/4 mark.
View 1 Repliesi saw a thread while ago .. that always position a movieclip in the middle of the stage even if the stage or window resize any1 can point me to it
View 3 RepliesI can't access a variable on a the stage from within a movieclip thats placed on the stage.
View 4 RepliesI have the code the following code:
in root frame I:
var prevSec:*;
var currentSec:*;
[code]......