ActionScript 2.0 :: Changing An Object Name To A String
Apr 26, 2004
Is there any way to do this? Say I have a global variable called yarr: _global.yarr = textbox; and I want to change that in to a string, I want to change it to "textbox" instead of textbox. Is there any way to do that?
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
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?
To avoid a large segment of code I've set up button names that correspond with movieclips that are located in my library and exported for use with the code. I want to replace the movieclip currently on stage with another movieclip from the library depending on which button you click on. The code works fine, I'm achieving all the values I want, except for the fact that since the variables in the function are strings it gives me a coercion error saying that they're strings and not objects.
Here's the code: Code: Select all// Holder var holder:MovieClip = new MovieClip(); holder.x = 122;
Any way to change the specific character's colour within a string in a dynamic textfield. E.g. String = "There can be only one" I want all the o's to be orange...
I'm working with a web service and am returning an array to a field (that I set the data type as an Array). The result thus far is "[object Object]". How can I get the array values back out as a string?
So I have a bunch of objects (thumbnails) and I want every photo to be displayed on top of other photos once it's clicked. So what should I put inside the click handler inside the photo object?
Allright, i receive a string and want to convert it to object. here a test that i have made:
[code]....
this work pretty fine... but i am receiving the object property as follow: "{a:'test',b:'testAgain'}" How can i easily convert it to object properties?
I'm coming to AS3 from Director Lingo. In Lingo, a 'sprite' is vaguely equivalent to an object in AS3 and a 'cast-member' roughly corresponds to an AS3 library symbol. In Lingo I make a lot of use of lines likesprite("image").member = 25which changes on the fly the cast-member associated with a sprite, giving an instant image change when the user drags a dial, for example. This is particularly useful because the cast members in Lingo can be addressed by their sequence numbers as well as their names (giving a sort of implicit array addressing).In AS3 I can't see how to replace an image object with another image (not just a simple variation of the original). And even if I could do that, I can't see how to get the pseudo array addressing facility which I need to allow me to choose by code what image from perhaps several hundred will do the replacing.I guess what I'm asking for is maybe contrary to simple OOP.
I've got another simple question. I have a mc who's bitmap that is associated with him I want to change.
[Code]...
When BlankClip is first created, I want to tell it to either have the same image as Block_0 or Block_1. Looking it up online, it seems like I have to use BitmapData somehow, but I'm really unfamiliar with things...I've been working on this same code for about 2 hours...
For the first stage, I was able to build a walk-through demo in flash pro by creating buttons that when clicked caused the flash to change to different frames. easy enough. Now for the final part of this project, I need to make the interface fully interactive, as I was trying before. ie: you can click any button and lights go on and off or a loop counter increments, etc. Since there is logic involved and too many permutations to do a frame for each possible state, I'm back to trying to do this in an object oriented way. I've got some test code here.
<fx:Script> <![CDATA[ protected function button1_clickHandler(event:MouseEvent):void {
[code]....
debugger has some errors, so i don't know what exactly it will do. the errors are at the last two if statements where i'm trying to change the object property setting of the label. there is another error at the last curly bracket.
the idea is that there are two labels and a button. the first label starts out visible. when the button is clicked, a counter is checked, and incremented, then the counter is again checked and the appropriate label has it's visible property set to true. the intent is that in a list of several labels, pressing the button scrolls down them, until you press while on the last, which resets the counter and the first label becomes the visible one.
I'm having a game in which i control an MC with the keyboard arrows and when i click outside of the flash application and back in the MC loses focus. The focus changes to a button within the stage. What i've observed is that the Flash Player has a built-in control that moves focus from an item to the other with the arrow keys.
i am making this simple drag and drop game using flash cs3 using as2.i got 4 games and it has the same codes but different game type.. basically it uses drag and drop.here is the problem, when i finish the game, and press the back button to go to the selecting game scene, the last object dropped in the previous game stays and appears in the scene after that.
below is the as2 code i am using.
--- // global variablesvar tabbingON = false;var draggingON = false;var selectedPiece = 0;var totalPieces = 10;var total = 0;var mySound = new Sound();var origPos:Array = new Array();var justHit = false;var offset = 50;var counter = 0; // function callsinitGame();
my designer made a fla file where he has animated layers loads of them. All the images inside those animations are loaded from outside the swf.
Now, the issue is at one point in time I want some of the objects to go under another object ( current their on top) . If I do this visually the images inside the swf(loaded) are lost.
I have a string of about 5 movieclips that are tweened so that when you click left or right they slide in that direction. When you click on the movieclips themselves I want them to:
on mouse down - move to (y-5) on mouse-up - move back (y+5)
this all works fine, however after I have clicked on one of the movieclips to make it jump, when I click left or right to slide them all over again they don't slide with the rest of the clips anymore?
okey i am making this simple drag and drop game using flash cs3 using as2.
i got 4 games and it has the same codes but different game type.. basically it uses drag and drop.
here is the problem, when i finish the game, and press the back button to go to the selecting game scene, the last object dropped in the previous game stays and appears in the scene after that.
below is the as2 code i am using.
HTML Code: // global variables var tabbingON = false; var draggingON = false;
I know that you can change changeobject's color with AS3 is using colorTransform. However if I do this, then I can't really use filters. For example, if I apply DropShadowFilter on an object which color is changed with colorTransform, then the color of a shadow is the same as object's color. So I tried to use ColorMatrixFilter to change object's color. And it works with colors like FF0000, but it doesn't with colors like FFFFFF. IS there a way to change objects color to white using ColorMatrixFilter? I use the following methods:[code]
I've got a frame of code with two boxes on the stage. If you click on of them, it runs this code: ActionScript Code: charSelect=1; And if you click on the other box it runs this code: ActionScript Code: charSelect=2;
Now, on my main frame of code, I've got an init() function which runs all the initialise commands. It includes this: ActionScript Code: function init() //Loads assets to the stage and starts animations { if (charSelect == 1) { character.addChild(character); } if (charSelect == 2) { characterFemale.addChild(character); }}
These functions basically let you select which character is loaded to the stage with the instance name 'character'. All my control code is written in relation to the instance name 'character'. However, after I've clicked the box which selects which character to load to the screen, I get this error message: ActionScript Code: Scene 1, Layer 'Layer 1', Frame 2, Line 155 1061: Call to a possibly undefined method addChild through a reference with static type Class.
I need to move a movie from let's say '_root' and put it into '_root.source.pages.ph' on level 0 in the current state that it is in....is there anyway you can do this using actionScript? DuplicateMovie starts the movie over at frame one and doesn't delete the old movie and swapDepths require the movie to have the same parent.
I am very new to Flash and I have the following script: mouseInterval = setInterval(changeAlpha,10); function changeAlpha(){ fader_mc.alpha = Math.round(root.mouseX/550*100) } This is simply to change the Alpha of my object as I change the X value of the mouse cursor. I keep getting the following error message: 1120: Access of undefined property mouseInterval
I've created a text object, writing let's say "HELLO". I then made it into a picture, and erased parts of the text, all the while taking frame captures (F6). It ended up looking great, even though I had 900+ frames. However, I now want to change the font colour...in each of the frames. Any easy way to accomplish this, I cannot go frame by frame. The object is in the same place each time, so if I could just put a mask on all the frames or something to change the colour to black, that would be sweet. I followed this tutorial [URL].
I need to be able to load up different flash files when users click an image in my gallary. My current solution works perfectly fine in Firefox, but Chrome and IE are not working and it isn't giving any error messages. I use jquery to change the embed source
for a periodic table tool I'm making, I've incorporated an effect that changes the alpha value whenever I hover over an element (pretty standard). I've noticed a mysterious gain in memory when hovering over my elements; using SYSTEM.TOTAL_MEMORY - there would be about 0.005MB increase in memory usage when I hover over an element, which isn't relinquished when I move my mouse off. However, if I move my mouse back on again, there isn't a second memory gain.
[Code]...
Does anyone know why this memory gain is happening when the alpha value is changed? And curiously why it only happens once? Some extra info: my Element class is a MovieClip, with a couple of TextFields, primitive variables and a MovieClip in it. It has had its mouseChildren property set to false (and buttonMode property set to true).
I am trying to change a text fields text when I am rolling over with my mouse over an object. I currently have this code:[code]Now the problem is, how do I switch back. When my mouse isnt over the 'roulette_deur' button?