ActionScript 2.0 :: Flash & XML: String To MovieClip?
Mar 11, 2008
I've have an XML file and from that in Flash (Actionscript 2.0) I pulled from a node an attribute that returns the name of the MovieClip I want to call. So this returns a string say "chicken_mc". There is already an existing chicken_mc placed on the root. I want to call that, so how do I use that string I pulled from the XML to call or turn into a movie clip? Right now I have: var cTemp:MovieClip = pTemp.attributes.movieclip; That's not working because a MovieClip can not = a String. Is there some function I can use to change the String. I tried cTemp._name = that too, but _name is read-only. I need the movie clip to be called this way because there are a number of different movie clips on the root that the XML might call. Also, there will be a number of iterations as well.
View 1 Replies
Similar Posts:
Feb 9, 2011
In my application I have a String like this..
var str:String = "The item is [mc]";
Here i need to replace the [mc] with MovieClip Object. Is this possible?
But i could not use TLF text,because it increases the file size.
View 1 Replies
Aug 14, 2010
the problem:I want to convert my string variabale to Movie Clip like this :var a:String="blue";I want to turn the value of (a) variable to MovieClip I mean I want it to be like this :var blue:Movie ClipI tested some ways like this but didn't responsear b:MovieClip=MovieClip(a)
View 1 Replies
Jul 1, 2010
i have to make an addchild to a movieclip, but i really don't know how to make it with a dynamic name.
for example
private function buttonClicked(nameOfTheButt:String):void
{
thumbs.addChild(nameOfTheButt);
}
[Code]....
View 4 Replies
Jan 15, 2010
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]...
View 4 Replies
Aug 15, 2010
I get following Error when trying to pass variables via URLRequestMethod.POST;
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
Is there a method for string URL Encoding?
View 4 Replies
Jan 23, 2003
I am sending a string to asp from flash that looks like this;
[CODE].....
The problem is when asp (probably php too) reads this string, it reads it like this
[CODE]....
Now this sucks, is there a way to encrypt my flash string so asp will read the string corectly? I know asp is url encoding the flash string, but this bit of info does not seem to help.
View 14 Replies
Jan 13, 2005
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.
In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.
For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com
If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.
Does flash have an object that deals with Regular Expressions? I've looked at the String object in flash but not sure how to achieve this task
View 2 Replies
Jan 13, 2005
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.In flash I want to parse the string that I get from the database and look for URL strings that start with http "URL..." and parse out that substring. For example the string could be "Please vist my site at URL...". I would want to parse out the URL...If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield. Does flash have an object that deals with Regular Expressions?
View 2 Replies
Dec 12, 2008
I have the code the following code:
in root frame I:
var prevSec:*;
var currentSec:*;
[code]......
View 1 Replies
Jul 28, 2011
My code is below. I have an external Class AS file doing most of my code but I need some of the moviClips to highlight areas (other movieClips) when they're rolled over. I've kept instance names the same + an H for their highlights to lessen the amount of code and be able to use array's and for loops.
My code is below and brings up this error:
Actionscript Code:
TypeError: Error #1034: Type Coercion failed: cannot convert "areanaH" to flash.display.MovieClip. at EnterpriseZone_fla::Layer1_1/end()
[Code] .....
View 4 Replies
Dec 12, 2008
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.
View 1 Replies
Jan 27, 2010
I created 4 buttons with 4 animations each, one for each state (using tweens), so I have that imense list of 16 "addEventListeners" (don't know if there's another way to do it). But everything is working as I would like.
The problem is that I'm trying to create only 4 functions to take care of all the 4 buttons and those 16 eventListeners.
This is part of my AS3 file (still with the "traces", 5 secs of animation to check the animations and all).
[Code]....
View 10 Replies
Jul 15, 2010
I have this bit of code. The highlighted area (I think) is causing "TypeError: Error #1010: A term is undefined and has no properties. at firstStep_fla::MainTimeline/placeDef()" The error appears when I go through the "match" section.
import flash.display.MovieClip;import flash.events.MouseEvent;
var numRight:Number = 0;var originalX:Number;var originalY:Number;var box:Rectangle = new Rectangle(0,0,450,380);
makeInvisible();
[Code]....
View 9 Replies
Nov 9, 2009
Basically I'm trying to get a certain section to open when it's corresponding button is pushed The button has an instance name of "home" The section I need to be able to reference is labeled "home_mc"
[Code]...
My gut tells me the code should work, but every time it runs through, I get "Actionscript Error:#1065: Variable home_mc is not defined."
View 2 Replies
Dec 9, 2009
I have a reference to a dynamic movieclip that I am trying to access from another movieclip, but I think the problem is flash sees it as a string rather than movieclip. Basically in a movieclip I have the following:
var changeMe:MovieClip;
var changeMe = "_root.scrollerClip."+_global.currentlySelecte d; // (_global.currentlySelected is the name of a movieclip i know exists, but adding the
[code]........
View 2 Replies
May 24, 2010
Is there a way to convert a string to a Movieclip. so if i have an item in the library called: A and a text field on the stage with a show button. And say I typed A and clicked the submit button it would show the A mc. I get an error...
1046: Type was not found or was not a compile-time constant: charUC.
ActionScript Code:
submit_btn.addEventListener(MouseEvent.MOUSE_UP, up)
function up (e:MouseEvent):void {
var char:String=myText.text.charAt(0)
var charUC=char.toLocaleUpperCase()
trace(charUC)
var mc:charUC = new charUC();
addChild(mc);
mc.x = currentSpot;
currentSpot = currentSpot + 100;
}
View 1 Replies
Sep 9, 2010
I had an old AS2 trick that I named "menuStatus" that I would use to for a file where I had several buttons. Each button would have it's over state, off state, and "current" state. When the button is in it's "current" state, it moves to a 3rd frame in the respective button (for this example - a basic color shift). I'll also eventually remove the listener when it is in this state. But first things first: I can grab a button's name using the "event.target.name" and assign it to a variable. But when I try to tell that variable to gotoAndStop(3), I get an error:[I]1061: Call to a possibly undefined method gotoAndStop through a reference with static type String.
ActionScript Code:
stop();
var current:String = new String();
var myBtns:Array = [one_btn, two_btn, three_btn, four_btn, five_btn];
[Code]......
View 9 Replies
Nov 27, 2010
I'm working on an adventure game and I need to find a way to pass the next MovieClip name to the function that loads it in the main timeline.
ActionScript Code:
Bowl_btn.addEventListener(MouseEvent.CLICK, BowlClick);
function BowlClick(evt:MouseEvent){
var nextMovie:String = "nameOfNextMovie";
this.parent.parent newMovieLoader (nextMovie);
}
This is all good but I can't find a way to use the nextMovie parameter in the function and load a movie from the library. I hope you can understand my explanation..
View 5 Replies
Jun 26, 2008
I'm trying to put together an XML based Flash map. On the right side, is a dynamically loaded XML menu. Now, my problem is that the rollover and rollout effects for the menu doesn't work. Basically, I have a movie clip that contains a dynamic textfield and another movieclip (the latter contains a button.I wanted it so that when the user rolls over this button, it plays, and when the user rolls out, it plays an exit "fade")[code]
I've tried using "var menuItem=this._name" to retrieve the "path" of my buttons when you rollOver them (which should be something like "mcContainer.menuItem.bCountyBG.gotoAndPlay(2) ;"), although I need the menuItem to change to whatever this._name is.It doesn't work because menuItem's returned value is considered a string, so I can't use it in my command---> "mcContainer.menuItem.bCountyBG.gotoAndPlay(2) ;I was wondering if anyone can tell me if it's possible to convert this string to a movieclip by some sort of function or other means?
View 2 Replies
Jul 25, 2008
I would like to pass the name of a movieclip to a string so my attachmovie method can work. what I m doin is :
function createBlocks(slot:MovieClip)
{
...
...[code]...
when I call the above function on a keyframe I call it like : this.createBlocks(block4);
block4 is the id name of a movieclip in the library. the problem is that the attachMovie method needs a string as a parameter! how can I convert that to a string? so afterwards, slot , has inside the name "block4" (with the quotation marks)
View 1 Replies
Jun 29, 2011
Is it possible to convert a string to a movieclip instance name.
Code:
var theName:String;
MovieClip(theName);
but it says, "Type Coercion failed: cannot convert "mv3" to flash.display.MovieClip"
View 3 Replies
Sep 19, 2009
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method.
I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 4 Replies
Dec 31, 2009
Converting AS2 to AS3 , In my project I have an array that refers to a set of movieClips and textFields. I want to cycle trough the array and find out wether the string represents an movieClip or array.
PHP Code:
var changeFocusItems:Array = new Array();changeFocusItems.push("myMovieClip");changeFocusItems.push("myTextFieldOnStage");for each (var myItem:String in changeFocusItems) {if (myItem is
[Code].....
How do I recognise myItem string as a textField / movieClip?
View 2 Replies
Sep 21, 2010
I'm trying to add a custom object to the stage by calling a function like this:
Code:
var effectName:String = new String("Explosion");
var thisObject:MovieClip = //some movie clip class, like an enemy
addFX(effectName, thisObject);
[code]....
How can i turn a string value into a movieclip?
View 2 Replies
Aug 2, 2009
on the mainTimeline if have a movieclip. inside this movieclip i have a script that loads text from database. what important note is: var myPageText: String
now if i place inside this movieclip a other label further in the time, and create a action to call out myPageText like: my_input_text.htmlText = myPageText; this works fine
now i want this to work inside a other movielip in other scene. is it possible to call myPageText???
View 11 Replies
Apr 6, 2010
The scenario is as follows:
I have a movieClip on the stage called "home_btn" and another called "home".
When moving over the home_btn movieClip I want the timeline inside of home to play. I used the slice command to get rid of the _btn which works fine, which is proven by the trace command, but it doesn't seem to be able to enter the timeline of home.
home_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
function onOver(event:MouseEvent)
{
var selectedButton:Object;
[Code]....
View 1 Replies
Nov 11, 2010
I'm trying pause a video netstream within a MovieClip with a button (ppBtn). This works when I hardcode the movieclip path (like: etc. media2.ns.togglePause() ), but when I use a string in the path to access the MC's netstream it doesn't work. I've tried serveral ways to cast the string to a movieclip.name but I always trace a "null" or "undefined" of the mcpathI've tried to cast the string as a MC in different ways without any luck:
this[myString]
MovieClip(myString)
mySting as MovieClip()
[code].....
View 5 Replies
May 27, 2011
I've a general question on accessing a MovieClip by using a variable.Here's a super stripped down version of the code I'm trying to implement:
var mcVar:String = MC1;
addEventListener(Event.ENTER_FRAME, eF);
function eF(e:Event):void{
[code].....
View 1 Replies
Dec 19, 2007
I'm trying to reference a variable of type String as a MovieClip that is linked from the library. For example, I have a linked library movieclip called HomeFrame, in my class I have a variable with "Home" and need to create an instance of HomeFrame based on the string I receive.[code]
View 4 Replies