ActionScript 2.0 :: Getting, Setting Contents Of A Field, Whose Name Is Parsed Out Of Target Path

May 23, 2009

It seems that every scripting language I start using, it all goes back to this problem. How do I evaluate a string as a variable name or text field name, and get or set the contents of that variable or text field?

Code:

var mySelf:Person = new Person ("Enter Your Name", "Enter Your Email", "Enter Your Phone");
//Person is an external class file. The variables in it are named "_HomName, _HomEmail, _HomPhone."

[Code]....

View 1 Replies


Similar Posts:


ActionScript 1/2 :: Getting, Setting Contents Of A Field, Whose Name Is Parsed Out Of Target Path?

May 23, 2009

It seems that every scripting language I start using, it all goes back to this problem. How do I evaluate a string as a variable name or text field name, and get or set the contents of that variable or text field

var mySelf:Person = new Person ("Enter Your Name", "Enter Your Email", "Enter Your Phone");
//Person is an external class file.  The variables in it are named "_HomName, _HomEmail,

[code].....

View 4 Replies

Actionscript 3.0 :: Setting A Target Path For A Library | Flash CS4

Jul 9, 2009

I am trying to create a class library in the documents folder on my mac to save reusable .as classes. I tried following the tutorial on gotoandlearn about this, but it doesn't seem to be working out. I set the path in the prefs in flash using the browse button, and then set up the import line in my .fla. When I test, I get errors that say that flash can't find the dir that I am trying to use. Here are some details...

This is the dir structure that I am trying to use to store my classes.

This is how I am trying to link up to the classes using import in flash.

Here is the preference settings that I am using to get flash to look in the dir structure above to find classes to import.

View 3 Replies

XML Data Parsed To Dynamic Text Field Within Buttons?

Sep 2, 2010

I've got my XML file loaded and parsing correctly with a trace statement.

I want to have each text identified as marketLocation1, marketLocation2, etc up to 150 and I wanted to use a 'for loop' to place the value of that XML node into each labeled text field, and each individual text field is buried inside a button so that the button displays on mouseover an associated XML fields data. Each button would also be corresponding labeled market_1, market_2, etc.

Meaning, I mouse over a dot on a map (button) and it pulls up a statistics balloon about that location specific to our companies needs. I'm a total AS3 noob, so I'm not sure if I can preload the data for that button into it's specific text fields.

Specifics are for the xml/flash file


Code:
<market MarketID=1>
<marketLocation>Raleigh-Durham-Chapel Hill, NC</marketLocation>
<marketPopulation>2,600,000</marketPopulation>
<marketArea>100 sq. miles</marketArea>
</market>

I have markets divided up into regions. I have the base map, which when you click each region goes to a new labeled scene on the root timeline. The scene shows a closeup version of the region. On that region are the dots for the markets. Each dot would have an up state and over state (displaying the pop-up balloon with data) etc.

I'm working on the first 'button' as the initial test and what I want to do is make is that i can use a For loop to cut down on the code, using the variable i in place of the "1,2,3..."

The first button, market_1 is in a labeled scene SERegion on the main timeline. While the code I'm using to parse all the fields is in frame 1.

When I try to place the value of marketLocation located inside the button market_1, I am trying to do this when I parse the data

Code:
function parseData (marketInput:XML):void {
market_1.marketLocation1.text = marketInput.market.(@MarketID == 1).MarketLocation.text();
}

When i compile, i get the error 1119: Access of possibly undefined property marketLocation through a reference with static type flash.display:SimpleButton

MarketLocation is also in just the Over state of the button.

View 2 Replies

ActionScript 2.0 :: Contents Of A Text Field As The Dial Points In The Direction Of The Text Field?

Nov 15, 2004

I am working on a file that has a rotating dial, and I'd like the dial to reveal contents of a text field (a link) as the dial points in the direction of the text field. I have 4 text fields located at 90, 180, 270 and 360 degrees (top, bottom, left and right). I have it controlled via AS, so I've got all the Math but I was hoping someone might know how to reveal the links when the arrow (in the dial) is pointing in these directions.I set up a text field for testing, which shows the degrees, but I'm getting 'NaN' in the field (problems with Theta and converting degrees to Radians, I think). I thought this might help me figure out how to reveal those links, if I can get the NaN to work.Currently, the file is rotating with an onPress, but I'm going to convert it to a mouse follow, instead, so the user only has to float around to see the links.

View 5 Replies

ActionScript 3.0 :: Multiple Buttons Share Single Loader For Loading Each Of Their Target Contents?

Jun 26, 2009

I am trying to have one single loader for different buttons to load their specific target. lets say I have btnOne and btnTwo, each of them have their page to link to, btnOne to pageOne, btnTwo to pageTwo, page one and two are external swfs. so can I load them into stage by sharing one single loader?

this is simply my script:

ActionScript Code:
var swfURL:String = ("external.swf");
btnOne.addEventListener (MouseEvent.CLICK, startLoad);
btnTwo.addEventListener (MouseEvent.CLICK, startLoad);

[code]....

View 2 Replies

ActionScript 3.0 :: Multiple Buttons Share Single Loader For Loading Each Of Their Target Contents

Jun 26, 2009

I am trying to have one single loader for different buttons to load their specific target.lets say I have btnOne and btnTwo, each of them have their page to link to, btnOne to pageOne, btnTwo to pageTwo, page one and two are external swfs. so can I load them into stage by sharing one single loader? this is simply my script:

[Code]...

View 2 Replies

Professional :: Pass The Contents Of The Text Field To Another Text Field?

Nov 8, 2010

I've created a dynamic text field - mediaImportName001 (created , and populated it with the name of a file that I choose to import using a browse button (as3 and AIR).This works fine - I can import the file, and the name appears in the field.
 
I'd now like to pass the contents of the text field to another text field.  But I can't get the contents. If I try to trace the contents of the textField trace("mediaImportName"+thisNum).text     - Flash returns "undefined" (even though I'm asking it to trace after the field has been populated).
 
I use the following code to check that the field really is there and named correctly (the code returns the children):
 
for (var i:uint = 0; i < this.numChildren; i++){    trace (this.getChildAt(i).name + ' type:' + typeof (this.getChildAt(i))+ ' ' + this.getChildAt(i));}
 
it returns:
 
instance370     type:object    [object Shape]mediaImportName001     type:object    [object TextField]mediaFiletype001     type:object    [object TextField]
 
How do I get Flash to give me the text in mediaImportName001?  
 
It's bizarre - this.getChildAt(i).name
 
from above gives me...
 
mediaImportName001     ,
 
yet
trace (["mediaImportName"+thisNum].name); 
 
returns undefined (thisNum represents an increment I use to name multiple clips and text fields, and in this case trace(thisNum); returns 001)

View 4 Replies

Professional :: Using The Target Path Tool?

Feb 14, 2012

I realise that I need to keep all my code on the main timeline, so now I need some serious help with targeting movieclips and buttons, when I use the target path tool (the little gun sight in the action script panel) it lets me navigate to the thing I want, but when I use it's suggestion it very often doesn't work, and I am left using trial and error to work it out.  Ican get stuff to work, but I really have no idea why or how I am doing it, Sorry to be such a N00B, but I really think if I can work this out I am going to get

View 5 Replies

ActionScript 2.0 :: Specify Target Path Using 'tellTarget'?

May 20, 2004

how do you specify the target path using "tellTarget"?Ex. The target movie clip is on the main timeline but the "tellTarget" script is on another. How would I code this? (or should I just use the standard "gotoAndPlay"?)Is tellTarget really even relevant anymore? It seems to me that with the release of FMX 2004, Macromedia advocates using gotoAndPlay more than tellTarget. Why would you use tellTarget when gotoAndPlay does essentially the same thing (or does it?)?

View 4 Replies

Asp.net :: Setting URLRequest Path?

Nov 12, 2009

fla files which is calling default page . but it's not able to find the default page.. my default.aspx page is in root directory ,and my fla file is in ../capture/image.fla . here is my code

[Code]...

View 2 Replies

ActionScript 3.0 :: Using Correct Path For (Event.Target)

Jan 8, 2010

Previously it was put as keepLevel1(event.target) at each seperate function. Now I would like to make it frun the functions after an object is successfully loaded. How should I change the (event.target) to?

ActionScript Code:
private function startSearch(event:MouseEvent):void {
var loadID:String;
loadID=searchArea.text;
myLoader2.load(new URLRequest("GetData.aspx?id="+loadID));
myLoader2.addEventListener(Event.COMPLETE,processXML2);
[Code] .....

View 0 Replies

ActionScript 2.0 :: LoadVariablesNum(url,target) Load From Another Path?

Mar 12, 2003

I've got a question about the path of the txt fileI can easily load a txt file in a movie if the txt is in the same folder as de .swf, but when i try to load a txt file from a different levelfor Example projects/com/1.txt i dïn't see any txtthe code is:loadVariablesNum(projects/com/1.txt,0) i know the code is wrong, but can somebody tell me what i have to do to get a txt form a different level.

View 1 Replies

ActionScript 2.0 :: FMX Target Path That Works Both Ways?

May 25, 2003

i have a main-movie with a movieclip called "area", into this movieclip is loaded an external movie.swf

a clip inside this movie.swf has the below script
onClipEvent (enterFrame) {
_level0.area.displayfield = "hello"

[code].....

View 3 Replies

ActionScript 3.0 :: MovieClip Target Path Are Soo Complicated?

Apr 26, 2010

I am wondering why the AS3 movieClip target path are soo complicated? I'm loading a simple external swf that contain a movieClip that I want to play with. But I can't find the proper syntaxe to call this movieClip..

var swfLoader:Loader = new Loader();
holderSWF.addChild(swfLoader);
var externalSWF:URLRequest=new URLRequest("externalFile.swf");
swfLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, loadProdComplete);
swfLoader.load(externalSWF);

[Code]...

View 3 Replies

ActionScript 2.0 :: [mx2004] Target Path Woes?

Apr 13, 2005

im attempting to build my first site in flash, and it was all going ok till i decided to get clever!I did have snippets of a.s everywhere, but have been trying to move it all back to frame1 on the main timeline (issat best practice?)the problem im having is that a simple piece of code on a nav button just wont work.when the code was within the same movie as the button it was easy:

btnWelcome.onRelease = function(){
trace ("clicked")
}

[code]....

View 2 Replies

ActionScript 3.0 :: Setting Target On Movieclip?

Nov 16, 2009

I have created movieClip through AS3 code but I need to set target on my movie clip. How to do .

private var myClip:MovieClip=new MovieClip();
// now i need to sent target on this myClip.

View 3 Replies

ActionScript 3.0 :: Book And Target Path Icon Wrong?

Feb 10, 2009

I've now found the code:MovieClip(root).square_mc. rotation= 45;Which has solved the problem fantastically.However my book suggests this format:root. square_ mc.rotation = 45; Also, using the 'insert target path' icon in the AS Window gives a similar syntax. eg for the above it gives this.parent.square_mc.orroot. square_ mc.Neither of which work, and generate the following message 1119:Access of possibly undefined property square_mc through a reference with static type flash display: DisplayObject.Am I doing something wrong, or does this style of controlling multiple time lines just not work?

View 2 Replies

ActionScript 3.0 :: Path Or Target Frame Inside Of MovieClip?

Mar 8, 2009

I'm trying to reference a specific frame inside a MC in my .swf file from an .as file. What I want is to capture the current frame of the movie clip for the .as file. It's for the purpose of points when you shoot each plane. It's an easy trick of frame 1's plane would be worth 100 points, frame 2's plane 200 points, etc. I thought I'd write a line like this in my collision detection section of my .as file.

Code:
planePoints = currentFrame * 100;

The only problem is, of course, it grabs the current frame of the main .swf timeline that my flash file uses, and not the movieclip that's being called to produce the planes. So I thought I'd be able to specify a path to the movie clip (in this case it's called Airplane in the MC's linkage properties).

Code:
planePoints = Airplane.currentFrame * 100;
Then, of course, it freaks out and says that 'access of possibly undefined property currentFrame through a reference with static type Class.'

I still get confused with AS3 and the way items are handled vs AS2. I've lost track of how many times I type _root. Am I getting something basic mucked up here or should I be importing something in the package to get it to recognize the class?

View 1 Replies

ActionScript 2.0 :: Target Path In External SWF Not Working Correctly

Jun 5, 2007

Alright, so I've tried quite a few things with no luck. I have a scrollbar that works in the swf fine, but when loaded into my mainmovie container I get this error...
Target not found: Target = "/scrolling text " Base = "_levelO.swf container"

Basically I understand this to mean that the externally loaded movie cannot find the instance name /scrolling text. The code is as follows that I have set to the scrollbar button in the externally loaded swf....

on (rollOver) {
tellTarget ("/scrollingtext") {
nextFrame();
} gotoAndStop("down1");
}

I tried changing the target to _root.scrollingtext with no luck. Also tried _parent.

View 1 Replies

ActionScript 3.0 :: Setting Path To Library Folder?

Jun 21, 2010

What I have is some actionscript that displays an image from an external folder. All I have to do is specify the location of the folder, e.g,
Code:
var path = "icons/"

However, this is going to be used as a widget that people can embed on their site, I can specify the full URL to the icons folder and the app works, but to save bandwidth I've imported the images into the flash library under the folder "icons". All I need to do is set the path variable to the icons folder in library and it should work by the loading the images from the library rather than loading the images from my site.

View 1 Replies

ActionScript 3.0 :: Input Text Field Contents Move Unexpectedly?

Sep 16, 2009

When it loads, my AS3 script generates input type text fields with filler content text e.g. "type your text here."

The problem is, when the user clicks the text field, the content inexplicably moves to the left so that the first several characters are outside the text box and no longer visible. [code]...

View 4 Replies

Actionscript 2.0 :: User Save The Contents Of An Input Text Field?

Mar 11, 2010

I have created a simple Flash file using actionscript 2 (CS3) that allows a user to enter text into an input text field and then print the results. Now what I want to do is allow the user to save the information they've typed in a file of some sort. I would prefer a .pdf, but I'm not married to that format.

View 1 Replies

ActionScript 2.0 :: Target Path To Movie Clip Element Of A Button?

Jul 16, 2004

I'm trying to figure out how to use AS to access frames of a movie clip within a button symbol (using Flash MX 2004), and I seem to be stuck. I drafted a small test version of the FLA I'm working on, and it is attached to this message.

Specifically, my intention is to have a two-state button that goes into "selected mode" after the first mouse click, and then goes back to normal after a 2nd click. I can already handle the functional aspect of this using a global boolean like the one in the attached file. The problem is that I want to represent the current status of the button with a visual change; in the attached example FLA, the intention was to change the color of the text label on this button from grey to red when the button is in its "selected" state.

In this forum I found a similar question where someone had provided a "menu.fla" that had a row of buttons that acted more or less like a radio set, which is somewhat similar to my need. I've been trying to use the same sort of method, having converted the "up" state of the button text into a movie clip symbol with two frames (one for each state), and then trying to use AS to do a "gotoAndStop()" on the desired frame of the up label animation. The problem is that I cannot figure out how to actually make this work ... no matter what sort of path I try to use to get to the movie clip animation within the button, I cannot seem to set the text animation to jump to the "selected" frame (2).

I think my problem is that I've been unable to glean any understanding from the Flash MX docs about the differences between an object name and a symbol name and an identifier and an instance name and a blah blah blah, or about which of them (if any) actually is an ID that can be accessed via ActionScript. Also, MX 2004 seems to provide almost no compile-time error checking on the validity of a target path either, so I've been reduced to just throwing every combination at it that I can think of. None have worked, so I'm at a loss.

If anyone can explain to me why the attached FLA doesn't cause the text to stay red after a mouse click, no matter which of the commented out lines I try, it would undoubtedly be a big help to me.

(Please note that the button in this FLA uses a basic flashing animation for mouseovers ... it was just something quick to implement to emulate the mouseover animation in my full file, so please don't be distracted by it. Also note that I haven't tried to implement any code to return the button to a non-selected status yet. One thing at a time.)

RESOLVED: It was apparently the nesting of a movieclip inside of a button that prevented the original target path from working (and one of the tutorials at this website seems to support that). Once I knew what the proper path syntax was and didn't have to worry about that part anymore, eventually the rest fell into place pretty easily once I started using a movieclip for the button rather than an actual button.

View 3 Replies

ActionScript 2.0 :: Variable - Feed The Path Of A Target To A Function And It Needs To Rewrite To Set A Value To It

Apr 15, 2006

I need to feed the path of a target to a function and it needs to rewrite to set a value to it. example below

[Code].....

Basically it works if it's only one target name with no previous/subsequent targets like path1 works but not path1.box is there any way to fix this?

View 10 Replies

ActionScript 3.0 :: Controlling MovieClip With Frame Label - Target Path

Oct 5, 2009

I'm trying to control a movie clip called "nosotrosmc" with a frame label inside called "historia" but does not work
Code:
menu.nosotros.addEventListener(MouseEvent.CLICK, subSeccion);
function subSeccion(e:MouseEvent){
trace(""+e.target.name+"boton clicked");
this.nosotrosmc.gotoAndStop("historia");
}

The output window show this:
nosotrosboton clicked
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at HomeSonny_fla::MainTimeline/subSeccion()
I need to made a simple navigation, I'm a designer, not a programmer.

View 6 Replies

ActionScript 2.0 :: Target Path To Movie Clip Element Of A Button

Jul 16, 2004

I'm trying to figure out how to use AS to access frames of a movie clip within a button symbol (using Flash MX 2004), and I seem to be stuck. I drafted a small test version of the FLA I'm working on, and it is attached to this message. Specifically, my intention is to have a two-state button that goes into "selected mode" after the first mouse click, and then goes back to normal after a 2nd click. I can already handle the functional aspect of this using a global boolean like the one in the attached file. The problem is that I want to represent the current status of the button with a visual change; in the attached example FLA, the intention was to change the color of the text label on this button from grey to red when the button is in its "selected" state.

In this forum I found a similar question where someone had provided a "menu.fla" that had a row of buttons that acted more or less like a radio set, which is somewhat similar to my need. I've been trying to use the same sort of method, having converted the "up" state of the button text into a movie clip symbol with two frames (one for each state), and then trying to use AS to do a "gotoAndStop()" on the desired frame of the up label animation. The problem is that I cannot figure out how to actually make this work ... no matter what sort of path I try to use to get to the movie clip animation within the button, I cannot seem to set the text animation to jump to the "selected" frame (2).

[Code]....

View 3 Replies

ActionScript 3.0 :: Loading External Swf And Setting Its Relative Path?

Nov 1, 2009

I am trying to create a flash viewer, which will load various other flash movies. The viewer will be in the root directory, but the flash movies it will load are a few directories deep.

/flashViewer.swf
/myContent/someProgram/program.swf
/myContent/someProgram/audio/sound1.wav

It seems that when I load one of these movies into my viewer, the loaded movie is looking for the sounds in an audio folder in the root directory, and not relative to the swf I loaded. Is there a way to set this? I would rather not have to make the changes in each of my other movies to use the absolute path

View 7 Replies

ActionScript 2.0 :: FLVPlayback - Setting Path In Component Parameters

Oct 4, 2011

I have a video which has an flvplayback inside. I have been using it for others flv. But with these 3 flv, when I set the path in the component parameters, flash shuts down. I have used aftereffects, media encoder to convert them from mov and avi to flv.

View 0 Replies

ActionScript 1/2 :: User Save A Copy Of The Contents Of An Input Text Field?

Mar 10, 2010

I have created a simple Flash file using actionscript 2 (CS3) that allows a user to enter text into an input text field and then print the results.  Now what I want to do is allow the user to save what they've typed in a .pdf.  (I would prefer a .pdf, but I'm not married to that format.)

View 1 Replies







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