ActionScript 2.0 :: Grabbing Part Of An Instance Name And Using As A Variable

Jun 11, 2005

I have 36 buttons on my stage that are named [thumbBut0, thumbBut1, thumbBut2,..., thumbBut35]. Each button is a thumbnail image. I want to have it so that when the user clicks on a given thumbnail, the full-sized image corresponding to the thumbnail gets loaded and viewed...yada, yada, yada... So, if the user clicks on thumbBut25, the 25th image gets viewed...

My question: is there some cool way that I could avoid writing 36 different (although they would be similar) "_level0.thumbButXX.onRelease = function()..." type things for each of the 36 buttons. In other words, when the user clicks the instance "thumbBut25" something grabs the "25" part out of the instance name, converts it to an integer, and passes it on to a function that loads up the image that corresponds to "25"?

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Grabbing A Variable In A Function From An External Swf?

Feb 21, 2007

I need to trace out the variable currentClip from the following code that is in an external swf. The parent swf calls the external swf empty_mc via loadclip.

[AS]
function setNextClip():Void
{
currentClip = clipArray[iterator];

[Code]....

View 4 Replies

ActionScript 3.0 :: Using CurrentTarget As Part Of Another Instance Name

Jun 20, 2010

I'm new to AS3 and was wondering how I can use something like:
var mc:MovieClip = MovieClip(e.currentTarget);
As part of another instance name.
For example if the currentTarget was a move clip with an instance name of "oneNav" and then I wanted to control a movieclip with the name of "SuboneNav", how could I do it? All the variations of concatenation I'm familiar with weren't working. I even tied getting e.currentTarget.name instead but there always seems to be an issue.

View 5 Replies

ActionScript 2.0 :: [FMX] Subtract Part Of Instance Name In Function

Aug 1, 2004

I have the following code from a tutorial on Kirupa:

Code:
_root.currMovie = "home";
container.loadMovie(_root.currMovie+".swf");
_root.home.gotoAndStop(2)

[Code]....

As you can see are the button names: home, about, service and contact. This are also the names of the external swf's. But now I have chanced my button names in: btn_home, btn_about, etc. Now is it a little stange to name my external swf's btn_home etc, so how can I substract the prefix btn_ from the buttons so that the externa swf's can keep their normal names? I know it has something to do with substr but I don't know how and where to implement it.

View 3 Replies

ActionScript 2.0 :: [FMX]Substract Part Of Instance Name In Function?

Aug 1, 2004

I have the following code from a tutorial on Kirupa:

Code:
_root.currMovie = "home";
container.loadMovie(_root.currMovie+".swf");

[code]....

View 3 Replies

ActionScript 2.0 :: [Flash8] Use Many Copies Of One Instance To Build The Visible Part Of Maze?

Aug 1, 2006

I am writing a maze program for school. I am using a 2d array to represent to location of walls for the maze. The background (for figuring out where a player can move) is not the problem.I am using this algorithm for places the images...

for (i = 0; i < 22; i++) {for (j = 0; j < 16; j++) {if (maze[i][j] == 1) {instanceName = "wall" add i add j; //for multiple names for each instance
duplicateMovieClip("wall", newname = "instanceName", 1);
setProperty("instanceName", _x, (25*i+13));

[code]....

What needs to be done to use many copies of one instance to build the visible part of my maze? I want to be able to have all pieces anmed "wall" instead of "wall1", "wall2", etc...which isn't working anyway.

View 5 Replies

ActionScript 3.0 :: Create New Instance() When Instance Is A Variable?

Feb 12, 2012

I have a base class I've used on 6 different MC's. Then when I use these MC's my function runs an if statement to check which one to add.

if(id=design) var obj = new design();
if(id=team) var obj = new team();

I want to make it a bit more dynamic and use the id:String to evaluate which new instance to create.

ActionScript Code:
public function loadChapter(id:String):void {
var obj = new instance_of( id )();
}

View 5 Replies

ActionScript 2.0 :: Get A Part Of An Array-name In A Variable

Mar 21, 2011

I have an array named "lagers1" when I trace lagers1[0] I get: lagers1[0]= _level0.firth_l0

Now I want to decide if "firth" is in the name of "_level0.firth_l0". I have tried with slice but all the time it shows undefined. Is there a way to get a part of an arraymname in a variable?

View 9 Replies

ActionScript 3.0 :: Variable Of Null Value Assignment To A Variable Or Instance Flash?

Jan 7, 2010

As we know whent here is no such variable of null value assignment to a variable or instance flash throws this kind of Error.In one of my Application i need to get more flashVariables, They may or maynot come as FLASHVARS. But when i miss any variable flash thows this error as an alert box. is there any simple solution to avoid this kind of issue
 
when i use try,Catch statement the issue will not come, But i don't like to write Bunch of try,catch statement for all this kind of variables.

View 4 Replies

Where The Connection Is Set Between The Text Part And The Array / Variable READ

Jul 3, 2009

in a flash template i found several buttons with almost the same action script code. on pressing the button a window popup with different text (for each button a unique text). the following code is in the code section of the buttons, only the two last codelines are different for each button.

[Code]...

so i think that the input of the unique text for each button is handled in the last line "_root.READ = 22". i also found in the bibliothek the belonging text parts. my problem now is that i dont know where the connection is set between the text part and the array/variable READ. in this case the connection is 22, but i dont found any property in the text part or in the property of the button where the connection is set to 22. i use flash cs4.

View 3 Replies

ActionScript 3.0 :: Grabbing A XML Value?

Jul 13, 2011

I am tasked with trying to do a slideshow of sorts, and I need to pull the filename of the slide from an xml file and display it, as well as display the appropriate slide notes in a text box.

the xml file they gave me is formatted as below, and with my current code (also below) I'm able to (trace) list all the file names, but I am missing how to address the filename on just one slide � say, slide 1, so I can then load it into a loader.

here's my code

Code:
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;

[code]....

View 1 Replies

Flash :: "Instance Name At Design Time" Vs "Instance Name Added Dynamically" Vs "Variable Name In Related Class"

Nov 4, 2011

Say i have a movieclip named a_Mc ( ClassA ) I have a sub-movieclip named b_Mc ( ClassB )

CASE 1: Accessing the sub-movieclip b_Mc which is already present inside the a_Mc movieclip

( Since Flash IDE has "Automatic instance naming" OFF )

ClassA mentions the name of b_Mc as => var b_Mc:MovieClip;

NOTE HERE: That the variable name MUST BE same as the name of the instance on stage.

So i can access it as : trace( a_Mc.b_Mc);

[Code]...

View 1 Replies

ActionScript 1/2 :: ExternalInterface With Grabbing URL?

Nov 13, 2009

I have a flash menu that needs to play a different scene depending on which page it is embedded into. So I need the it to grab the URL of the html page it is on and do some simple test on it to figure out what scene it should be on. *For the record, I tried to do it without scenes but the frame jumping started doing some cracked out things

Code: (on a single empty frame in Scene 1) import flash.external.ExternalInterface; var urlPath; urlPath = ExternalInterface.call("window.location.href.toStr  ing()"); getURL("javascript:alert('"+urlPath+"');"); if (urlPath == "http://www.awesome.com/Portfolio/portfolio.html"){ gotoAndPlay("Scene 3", "portfoliopage"); } else if (urlPath ==

[code]....

Somehow, my urlPath isn't getting the correct value, and therefore the if-else latter isn't functioning appropriately. I am posting the website on my test server, so the http addresses are correct, and the if-else latter functions perfectly when I just change the conditions to 'true'/'false', so neither is the problem. The problem is that the alert shows me that the value of urlPath is undefined, and so then all conditions in the latter evaluate to false.

View 5 Replies

ActionScript 3.0 :: Grabbing The Name Of A Symbol?

Apr 28, 2010

I can't seem to find anything that tells me how to do this.Is there a way to grab the name of a symbol on the stage? Not the instance name but the name that it has in the library.

View 2 Replies

ActionScript 3.0 :: Grabbing The Parent Of A Function?

Mar 23, 2009

I'm having trouble adjusting to the way functions pass in AS3. How come when I say "this" it doesn't know I'm refering to AudioTrack?

PHP Code:

var AudioTrack:Object = new Object();
AudioTrack.myVar = "Hello";
AudioTrack.onComplete = function(){

[Code]....

View 2 Replies

Actionscript 3 :: Validating And Grabbing This XML Attribute?

Aug 26, 2011

I'm getting my head around XML E4X in Actionscript 3 and been looking at Senocular's article about filters [URL] for a better way of validating the code below?

Essentially I want to check the profile nodes exist and if theres a profile node with a matching locale attribute (passed via FlashVars), and if not it grab the text of the first node. Anyway heres the code snippet and my XML is below:

function addInfoBubble(countryName:String, countryDataXML:XML):void {
// (theres other non related code here)
if(countryDataXML.achievers.achiever[0].profile as XMLList && countryDataXML.achievers.achiever[0].profile.length() > 0){

[Code].....

View 1 Replies

ActionScript 2.0 :: Grabbing / Formatting A String?

Jun 27, 2009

grabbing / formating a string.My mission is connecting to a web site - let's say domain.com/one.html - which returns the following html code:

Code:

<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>1,1,4,20,1,128,Harry J. All Stars - The Liquidator</body></html>

What I am looking for is a actionscript function which returns the text after the 6th comma - in this case:

Harry J. All Stars - The Liquidator

The thing is: The numbers are always different, but the text I want to "grab" and "show" in mytext.text (dynamic text) is ALWAYS present after the 6th comma.

View 1 Replies

ActionScript 2.0 :: Grabbing The Position Of A Value In An Array?

Dec 21, 2005

Okay, what I want is kinda hard to explain, so bear with me.If I have an array:Code:myPets = ["cat", "dog", "bird", "fish"];Now, is there any AS that can use the value of say "dog", and return the position that "dog" is in the array, I know this seems a bit stupid and dog is obviously myPets[1], but when I'm creating arrays on the fly it becomes slightly harder.

View 3 Replies

ActionScript 3.0 :: Xml Automatically Grabbing Images?

Nov 10, 2009

I'm used to flash grabbing an xml file that's manually edited with image file paths. Is it possible for flash or xml to automatically grab images that are in a specific folder?

View 2 Replies

ActionScript 2.0 :: Grabbing URL Of Current Page?

Jan 14, 2010

I am building a flash component to be embedded on an html side - the flash will include buttons to 'share' - i.e. on facebook, twitter, etc. I want to be able to grab the URL of the page and put it into the coding on the button.

Currently the button says:
tweetbtn.onRelease = function() {
getURL("http://twitter.com/home?status=Check Out This Company at www.thiscompany.com",

[code]......

View 1 Replies

Flash :: "Variable * Is Not Defined" In An Unfindable Part Of Code?

Dec 8, 2010

I am fairly new to Flash. I have a stage up with a simple button; the Instance Name is init. My .as script (MainTimeline) is accessed externally from the stage:

[Code]...

View 1 Replies

ActionScript 3.0 :: Grabbing Text Off Of A HTML Page?

Sep 16, 2009

I'm not sure if you able to do this or not. But basically I want to be able to grab text off a website (not the one the SWF is hosted on).

I have several sites from which I am making small amounts of money online.. I want to make a small app that loads the URL and searches the pages for the spot where the money is listed, then add them all up to shorten me having to consistently check each. The app could refresh loads, say every 30 seconds or so. Is there a way to do that?

Another example would be to make a text box in flash that displays the headline of an article on CNN.com

I did the like with loading XML from other pages, but what I want to do just involves grabbing any said text from a site.

View 2 Replies

ActionScript 3.0 :: Grabbing Info Based On Id# (php Mysql)?

Mar 19, 2010

I'm trying to create a website that will grab content from a MYSQL database, and display it inside of a dynamic text field in Flash. There are several buttons on the page, and I want each button to grab different information depending on id #. So far, I've done a few tutorials both here and elsewhere, and I've finally figured out how to get the Flash to connect to the database, but I'm not sure how to get info based on the id. My current database only has two columns: id & home_body with one row. I want to add more rows to this soon so I'll have something like this:

id | home_body
1 | info <-button 1 grabs this
2 | info <-button 2 grabs this

Here's my code thus far:

AS3:

// this code gets the home page data from the database for display
var homePageText:String;
// Assign a variable name for our URLVariables object
var home_variables:URLVariables = new URLVariables();

[code]....

View 3 Replies

ActionScript 3.0 :: Flash Grabbing Still/frame From Video?

Dec 27, 2010

[URL]..and I wanted to duplicate the effect and turn it into something.. I don't know, something. I just want to get it to work!

It's been a while since I did AS3 programming, so excuse me for being a bit rusty. I loaded a .mov as a FLVPlayback exported it as movie.swf and in the main.fla I made an URLRequest for the .swf. I then did all the silly math things that strobes it, and it all works out when I have an image, but with the movie.swf I just can't get it to work.

With the image it's just a matter of copying the bitmap and repositioning it. But how do I capture a still of the playing .swf?

I am a little bit lost within all the CopyPixels and BitmatData's and I just can't get it to work.

To make it short:

- I want to load a movie (a .mov in this case)
- I want in every frame to capture the frame of the playing movie and duplicate it/reposition it

View 1 Replies

ActionScript 2.0 :: Sound Grabbing And Playing From Next Scenes

Jan 9, 2012

I simply don't understand why now at the end of my project, the last 5 frames are giving me such trouble. I have five scenes. The first scene plays fine. Second scene plays fine until just the end, then it grabs audio from the third, fourth and fifth scenes and starts playing them. Here is the site: [URL] (it is a site for children in Swedish) if you click the 3rd button to the right (3 Delan) you will notice that the sound starts truncating and then starts grabbing and placing into scenes before the next scene.

View 1 Replies

ActionScript 2.0 :: Use Variable For An Instance Name?

May 6, 2011

Ok, I've been at this for 2 days now, and really need some assistance. It seems like it should be so simple!

The part that doesn't work [code]...

Then that button in the root should be able to take the value that is in the variable "critter_pressed_new" and use that as the instance name, to make that particular mc go away.

View 2 Replies

ActionScript 3.0 :: Using A Variable In An Instance Name

May 31, 2010

Simple question: I'm trying to use a variable to call on different instance names:

[Code]...

The code in red is the issue in question. In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"

View 16 Replies

ActionScript 2.0 :: Instance Name By Variable?

Jan 17, 2009

I have multiple inputs which I would like to limit the input on. Not limit to number of characters but limit to the actual input box. The problem is the limit script is not reading the variable I am sending to the function and is returning as undefined.

ActionScript Code:
function Limit(SetText){
oKey = new Object();
var __text0:String = "";

[code]....

View 0 Replies

ActionScript 2.0 :: Using Variable In Instance Name

Dec 3, 2009

I am trying to create an animation that will cycle through letters (each of which have an instance name) by using a loop. I have a variable which it outputting the numbers i need if just used in a tract but i want to add it to the end of the instance name so that each instance scales one after the other. Any way of delaying each one by a few few seconds (or milliseconds if I remember the acrionscript unit of time correctly).

View 3 Replies

ActionScript 3.0 :: Using A Variable For An Instance Name?

Feb 1, 2010

Basically I am having errors when trying to use a variable to set my instance name.

Here is the code:

ActionScript Code:
var i:Number = 1;
["button"+i].transform.colorTransform=myColorTransform; //doesn't work
button2.transform.colorTransform=myColorTransform;//works

'i' will always carry the button number.

I've tried all the methods I can think of so I am hoping that one of you can give me a hand, if I can figure this out I can probably save a few hundred lines of code in an app I have just started on.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved