Actionscript 3 :: Insert String Info Into Addressing A Movieclip?
Oct 18, 2010
I am trying to dynamically address different instances of the same movieclip by passing a string into the movieclip address, but apparently I don't know what I'm doing. I'm trying something like below:
var vsTargetName:String;
vsTargetName = "instance50";
vsTargetName + vsThumb.thumbHighlight.visible = true;
Is something like this possible? What am I doing wrong/what do I need to do to make that work?
I have 190 movieclips which display various types of information. When a user clicks on a movieclip, it has to tween larger but also send a string to a method. I'll probably e.currentTarget to use one function which contains a tween and I wondered if there was a quick way to pass string info in a similar way?
So, each movieclip has it's own value which can be passed to a method which will use that value. The only way I can think of so far is to have 190 functions which send the string data to the appropriate place. I'm trying to avoid that if I can.
var tabData0: Object = new Object(); tabData0.tab1 = new Object(); tabData0.tab1.names = new Array();
[Code]....
I want to combine this output with a few more to refer to my object / array. The remoteHolder contains the value I need to know which object (tabData0, tabData1, etc) to retrieve the info from.
on (rollOver) { name=this._name; path=this._target; _root.push (name, path); }
on the timeline i have the function:
_root.push = function (name, path){ trace(name); name.gotoAndPlay("over"); }
on rollOver i want to dynamically pass a movieclips name to a function which controls that the movieclip should goto its frame named "over", but i cant get the adressing to work.if i trace the variable "name" in the example it gives me the moviename correctly. so i guess my syntax is wrong.the function doesnt work with the path variable either.
I have three movieclip "buttons" within a couple of nested movieclips and I am unsure how to address them in actionscript. I have an event listener and a function for the rollover and rollout mouseEvents below
procedures_mc.p_dropdown_mc.p_body_mc.addEventListener(MouseEvent.ROLL _OVER, cursorOverButton); procedures_mc.p_dropdown_mc.p_breasts_mc.addEventListener(MouseEvent.R OLL_OVER, cursorOverButton); procedures_mc.p_dropdown_mc.p_face_mc.addEventListener(MouseEvent.ROLL _OVER, cursorOverButton); function cursorOverButton(e:MouseEvent):void{e.currentTarget.gotoAndPlay("over"); e.currentTarget.addEventListener(MouseEvent.ROLL_OUT, cursorOutButton);} function cursorOutButton(e:MouseEvent):void{e.currentTarget.gotoAndPlay("out");}
Within the movieclip buttons are labels over and out included in the buttons. When I rollover and rollout the mouse over the movieclip buttons they don't behave correctly. I am wondering if the e.currentTarget inside the function is the right address of the nested movieclip buttons procedures_mc.p_dropdown_mc.p_body_mc, etc.
I am loading an external XML file. According to the information loaded from the file I would like to highlight a symbol (MovieClip) when I press a corresponding button. The Button and the MovieClip change every time I load a new XML, so it has to be dynamic.I tried the following, but that doesn't work, does anyone know why?I have an Array defined (a_HighlightArray) that I fill within a loop to hold the object (as a string! ) that is supposed to be highlighted when I press the corresponding button:
How do I insert a hyphen in a hardcoded string that is the label of a button? Do I need to format it as html? Same question re: forcing a break in a line of text. is there a way just with ActionScript?
I know insideInput = String(xmlNode.childNodes[0].attributes.insider) virusTarget = insideInput.indexOf("kz", [17]); endTarget = insideInput.indexOf(".", [virusTarget+2]); trace("VTTT"+virusTarget) trace("ET"+ endTarget) //endTarget = local.indexOf(".", ["vitesting"]); clipTarget = virusTarget+3; zebra = insideInput.substring(clipTarget, endTarget); trace(zebra) I'm trying extract info from a string, increment through it and add the data to an array. I can't get the startIndex thing to work.
I'm building an ActionScript program in which I need to insert text into another string at random positions.I have the text which strings will be inserted into; and I have the strings which will be inserted as an array.However, I don't know how to go about inserting the elements of this array into the other string at random positions.
I neeed to insert spaces in front of capital letters in a string. the string contains the name of a country instance for example demRepublicOfCongo. I would like to scan the string and inset spaces before each capital letter so that the contents of the above string would become dem Republic Of Congo, for eaxmple.I found some code that It is posted below.
//Works out country name from string var country:String=counrtyinstance.replace("_mc",""); var re:RegExp = /(?<=[a-z])([A-Z])/g;
I simply want to insert a space before any capital letters in a string:So if I have "BruceWillis" I want to convert it to "Bruce Willis" . I am inserting the space before any caps, except the first capital letter.
Is there any way to fill in a dynamic text box in one movieclip if a checkbox from another movieclip on the main timeline is checked?If it is not checked, the dynamic text box would be blank.
I'm designing kiosks for educational museums. My current project involves visitors generating content in a Flash-based interactive, and then having the ability to email their creation to themself, or others. My intention is to publish a swf from my program to a webserver and then email the visitor a link to a webpage with the swf embedded I'm having trouble finding any info on publishing a movieclip as a swf from AS3.
I have some scrolling content (info). I've also made my own scroll bar.I want the scrollBar dragger to be positioned in relation to the info._y as the user scrolls info.I have created two vars: one that worsk out where info._y is as a percentage and the other that works out where the scroll._y dragger should be as a percentage...
Actionscript Code: var scrollBarPercent = Math.round(scrollBar.dragger._y / [code]........
also onMouseWheel working too.I need a small bit of code that takes the % of info._y and moves the scrollBar dragger to the same % but in relation to the Stage.height...so if projectGalleryPercent = 50%, make dragger._y 50% of Stage.height using scrollBarPercent.
I made a little movieclip animation, it can be seen on [URL]. I have written the code for it but then have realised that I need to insert a link to the images, each image is supposed to have its own link. When I go to insert a button flash somehow decides to ignore part of the code I wrote and not function properly therefore I cannot have a link and a working animation going on at the same time. The worst thing is that I need to put two separate links in the same movie clip. Is there any way of doing it so it wont disturb the code? or maybe is there a way to insert a link to the images?
The problem is,i dont know how to insert button into movieclip (draggable map) i've tried by inserting the button straight away into the movieclip,but when i play the map, the button cant function.
I'd like some help on using a variable in a path to a MovieClip. I have a menu with 4 tabs. When I click on one I want it to open and the previous one to close.
I'm storing the previous tab as a variable (_previousTab) but am having trouble adding the variable to the path to the MovieClip of the previous tab. The error Flash gives me is:
[Code]...
If I replace the variable _previousTab with the name of the MovieClip it works fine. I'm thinking it's something to do with the variable being a String perhaps?? Also, the trace statements return the desired MovieClip names.
I am trying to make a button, when you rollOver it, animation start to play. I try to insert animated movieClip into button, but in Flash 8 you can't do that.
I have try with ActionScript to call the animation to play when mouse is over, but also nothing.
Can somebody give me code or where can I found some button, when you go over it with mouse, that animation start to play.
Here's my scenerio: in my product info MC, user can select from 4 categories which gotoAndStop a nested MC. Each of the 4 categories has 5 hit areas on an "imagemap". The problem that I'm running into is that on each of those hit areas (mc's), I have actionscript - so that's 5 x 4 of essentially the same actionscript. Only difference is text information and _x & _y co-ord's (code is for caption/images boxes) Could I store all that data in an array in the product info MC rather than having 20 blocks of actionscript??
I just learned how to make a basic slideshow of images where one image shows for 3 seconds and then fades out and then a new one fades in, on and on. I imported my images, converted each image to a movie clip symbol and now they're arranged in my timeline. I need to add a NEW image at the very beginning of the the timeframe. I keep trying to Insert --> Frame, etc., but I'm not seeing a new first position in the timeline where my image will go. I'm used to video editing timelines and Flash is a real challenge for me.
So i am working on a pause menu for my game. I have an inventory box that has slots for weapons, powerups, and other items. I wanted different boxes that are specific to each type of pick-up (weapons, powerups, other). So I drew a box with 3 frames, it is set up similar to tabs in a web browser; click on weapons tab and you see your weapons in your inventory, click on powerups tab and you see the powerups etc...
In each frame I gave the inventory slots different instance names, i.e. in weapons; weaponSlot1, weaponSlot2, and in powerups; powerupSlot1, powerupSlot2.
When the player bumps into an item, i use gotoAndStop('frame number') so that each item is added to the proper inventory slot. the only problem is that if i bump into a key then pause the game, the key is there (under 'Other' tab), but if i click the 'weapon' tab and then go back to 'other', the key is no longer there.
This makes sense because when you click on each tab, i use gotoAndStop('frame number'), and in each frame the inventory slots are blank, so im stumped on how to keep each item in the proper slots?
I am going to i upload all my files in a zip, the main file that you will want to look at is the PauseMenu.as file
Also you will notice 3 public functions called 'checkWeaponSlots', 'checkPowerupSlots', and 'checkOtherSlots'. These are called in my main file, when the player bumps into an item, these functions are called to check which slots are empty.
i have few button to let user click and the symbol will insert into the input text. i change my input box to 'symbol' but i facing the problem that i can't insert character other than symbol...
I've been modifying some code I wrote a while ago that simply loads and plays an external FLV. The original code works well as I can simply copy the swf into any folder and when run, it will play the FLV with the given name in that particular folder.
I decided to have a photo still over of the movie before it plays, so I modified the script and 'loader' to put in the external Jpg. If I test the swf it works fine. But when I install the code from a sub folder into a webpage via 'object', the Flash file trues to find the photo in the webpage folder not the sub folder where the swf originates and where both the FLV and jpg are?? Both the FLVplayback and Jpg loader address in the same way in 'parameters' of properties, yet the FLV plays and the jpg won't. I only discovered what exactly was happening on a hunch and copied a different photo into the main web page folder with the same name.
I have also rewritten it a completely different way using movieloader, but got exactly the same results. I know I could put the full web address of the jpg into the parameters, but then I have to modify it every time I use it. I'd really like to be to simply copy it into another folder.