ActionScript 2.0 :: Access Selected Movie Elements On StartDrag?
Jan 14, 2009
I'm writing a FlashLite ActionScript2 piece of code. I have a series of textfields that are dynamically created and displayed on screen. I then wish to drag each of these textfields around. To achieve this I used some code from another flash site for dragging and dropping. I have two problems:
1) The txtMovies are dynamically allocated so each as a number appended to it, i.e. txtMovie0, txtMovie1 and so on. I can't figure out how to assign these in a non hardcoded fashion within a loop i.e.
object_array[0] = ("txtMovie"+i);
When I do this, it doesn't work. I think it's because it's not an object but a string. I tried using Object as a prefix to the part in brackets, tried [ ] etc... but couldn't get it to work.
2) In the function fnTxtMovieOnRelease I'd like to access the parameters (i.e. .text) of the selected text movie but, I don't know how to access it. I have no idea how to detect which of the movies are selected and thus access their individual text strings. I've tried to pass a parameter to the fnTxtMovieOnPress function but this then stops that code from working and I really don't know why.
View 3 Replies
Similar Posts:
Jun 25, 2010
I was wondering if it's possible to use the startDrag function AND giving the selected MC an elastic movement. Or if I 'm supposed to use an onEnterframe function instead.My project needs me to use startDrag only, but I can give a smooth elastic MC movement with this function.
View 2 Replies
Feb 24, 2009
I have a custom class I am working on, one of the methods is:[code]Inside that function a dynamic TextField is created called txtLoaded, it is declared with [code]mcProg is added to the stage, I see the txtLoaded txt field drawn as well and I can trace properties of mcProg from elsewhere in the class but I cannot access mcProg.txtLoaded from anywhere else in the class.I imagine this must be a scoping issue, with txtLoaded only existing inside the createProgress method, but is there any way for me to be able to access txtLoaded from elsewhere in the class?
View 5 Replies
Feb 11, 2011
i have an .as class that extends mx.containers.Canvas (it's a draggable border of a resizable component), it becomes draggable on MOUSE_DOWN and stops being draggable on MOUSE_UP, MOUSE_OUT and ROLL_OUT. before calling startDrag() i create a Rectangle to define the drag area, i also have a _dragging: Boolean variable to control if it's draggable at the moment. the problem is that when i click this border it jumps to a negative coordinate without calling startDrag or switching _dragging to true.
i've overriden get x, set x, get y, set y and move() methods in order to solve it but the only thing i got was the fact that position changes without calling coords setters or move(), but at the moment it's changed a getter is called and returns new (negative) value so my question is what happens on startDrag() and how to filter unwanted incoming coords values?
View 3 Replies
May 19, 2011
as you can see, I have a container MC which I have added to the stage. I set its drag constraints using a Rectangle(). I then add the 'cat' child movieclip to the container, and I want this to be dragable too. However, as soon as I click on my cat when testing the MC. It shoots to point x=0 y=0 on the stage and doesn't move.
The container MC can be moved without any trouble.
If I remove the rectangle bounds from the containers startdrag() function. both MC's can be dragged without any issue.
//panning ability
my_x = 800 - myImage.width;
my_y = 480 - myImage.height;
[Code]....
View 3 Replies
Aug 22, 2010
I had no problem working with xml in cumbersome AS2, but apparently it's menat to be easier in AS£, however I'm having a problem getting the data from this piece.
Basically I need to be able to access the id & src.
View 3 Replies
Oct 8, 2009
Here's an example of my XML:
</State>
<State name="AR" eVts="6" pCls="8:30 PM EST">
<PrecRepPct>11</PrecRepPct>
[Code]....
I'm wondering if its because there are two "Cand"s, or "Cand.length(); isn't the right thing to use or whatever, I've totally hit the wall.
View 1 Replies
Feb 3, 2010
I have a TileList with thumbnail images. Under each thumbnail images I display the name of the image. I want to build rename functionality. So under the TileList is a "Rename selected image" button.
When this button is clicked, I would like to change the state of the itemRenderer component. The label underneath the image will change into a TextInput so that the user can type a new name. This is much like the Windows rename file functionality.
How can I access the itemRenderer of the selected image? How can I make it happen that it listens to the click event of the Rename button?[code]...
View 3 Replies
Dec 16, 2010
Is there a way to access the child of a selected movieClip in JSFL.
ie i can access the selected movieClip using fl.getDocumentDOM().selection[i]. Now i also want to access the child of this movieClip.
My aim is to give instance name to all the movieClip in an FLA
View 1 Replies
May 2, 2011
So, my issue is this: I want to access XML like this:
Code:
someXML..nodeName
This returns elements with the name "nodeName" I need to do this dynamically like
[Code]....
View 2 Replies
Feb 23, 2010
I am unable to access 2nd element and 3rd element (I can access 1st element)
XML :
<data>
<text1> text1 </text1>
<text2> text2 </text2>
<text3> text3 </text3>
</data>
[Code] .....
View 1 Replies
Jul 9, 2011
I need to access the elements of an array that is declared in the main swf(_level0). But I need to change it from another swf.How can I do it??So far I have this:
MAIN SWF:
var vector1:Array = [biblio_vid1, biblio_vid2, biblio_vid3, btn_1_4, biblio_vid4];
OTHER SWF:
var vector2:Array = _level0.vector1.slice();
trace(vector2); // undefined,undefined,undefined,undefined,undefined
View 2 Replies
Jul 9, 2009
Is there a way to access the DOM-Elements of a mxml file in a way that you can in JS (e.g. using Prototype or jQuery)?
I need to know if a top-level element has a child (sub-sub-...-childs) with a certain id.
In JS (using prototype) it would be something like:
$('tabs').select('[id="something"]');
View 2 Replies
Feb 17, 2010
Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed.
View 3 Replies
Oct 27, 2010
var count:uint = 0;
var textInputs:Array /* of TextInputs */ = [];
for(var i:String in columnsData){
[Code]....
here how can i access the first, second of Array of textinputs in the form of string or any thing to further proceed
View 2 Replies
Jul 29, 2009
I have an object, myObj, that has no key/value pairs, only elements. When i trace it out i get the elements listed inbetween curly braces {item1, item2, item3, item4} I can access the first element by calling myObj.first( ) and I guess there are other methods I could try to call on the object - such as myObj.last( ) - but I can't seem to access the other elements in the object. I would like to be able to do something like:
[Code]...
View 5 Replies
Nov 17, 2010
I`m little stuck here, pretty simple solving problem I believe.
I`m trying to use this JSON library for my project.[code]...
View 1 Replies
May 21, 2011
I'm making a game where I have units that can move from square to square kind of like a game of risk but with squares.I want the units to be able to be dragged from one square to another.When I use the startDrag function on my unit it disapears.[code]so my workers show up in the square just fine.they just disapear when I drag them.some other minor details are:everything is in a big main MovieClip, class Square extends MovieClip and there is a .jpg on the bottom on the main MC.so the child level order is .jpg, then Squares, then the squares have Units (if they have units).Units are added to the Squares not the main MC.
View 11 Replies
Jun 15, 2010
I'm using Flashbuilder 4. I have a Spark TextInput control, and I'm implementing a "Copy" button that will copy the selected text only from within this control to the clipboard (pretty much like the RMB Copy does).
View 1 Replies
Sep 11, 2010
How can I Access Items Selected in a Component from the Main App I've got a component that has a listControl and a couple of RadioButtonGroups. I need to access the selected items in the main application. What's the best/simplest way to create and access the array of selected items. So, the user clicks the button to confirm the selections and then I need to access those selections in the main app. Is there a way I can use a public var to build the array? Another idea?
<mx:Tile direction="horizontal">
<mx:Box>
<mx:Label text="Year" fontWeight="bold"/>
<mx:List id="myYear" >
[code]....
View 2 Replies
Sep 6, 2009
How can I Access Items Selected in a Component from the Main App
I've got a component that has a listControl and a couple of RadioButtonGroups. I need to access the selected items in the main application. What's the best/simplest way to create and access the array of selected items. So, the user clicks the button to confirm the selections and then I need to access those selections in the main app. Is there a way I can use a public var to build the array? Another idea?
<mx:Tile direction="horizontal">
<mx:Box>
<mx:Label text="Year" fontWeight="bold"/>
[Code]....
View 2 Replies
Jul 9, 2011
I need to access the elements of an array that is declared in the main swf(_level0). But I need to change it from another swf. I have this:
MAIN SWF:
var vector1:Array = [biblio_vid1, biblio_vid2, biblio_vid3, btn_1_4, biblio_vid4];
OTHER SWF:
var vector2:Array = _level0.vector1.slice();
trace(vector2); // undefined,undefined,undefined,undefined,undefined
View 1 Replies
Jun 10, 2010
If I Have an XML variable that equals this:
var X:XML=XML("<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:ns1="Tools.*" minWidth="684" minHeight="484" creationComplete="Init();" xmlns:ns3="Components.*" initialize="I()"/>");
And I try to list the attributes via:
var AList:XMList=X.attributes();
The three namespaces, "xmlns:mx","xmlns:ns1", and "xmlns:ns3" aren't listed among the attributes! How can I access this information programmatically?
View 1 Replies
Mar 16, 2011
Access stage objects (like Movie Clip or text fields) from sub classes.The problem came when I define a subclass and try to access stage objects. How can I do that?Imagine I have a movie clip named redBox_mc on the stage.I want to change it`s alpha after I get my xml loaded.(or any other action in subclass)
Main class:
package src{
// ..
public class code01 extends MovieClip {
public var rt:xmlReader = new xmlReader("art.xml"); // my subclass
[code]...
View 1 Replies
Jun 20, 2011
how can you access elements in a 3D array using for loops?
View 4 Replies
Aug 9, 2004
I'm looking at the XML class. I would like to be able to access elements by name and the order they came in.
For example, if an xml document is structured like this:
<a>
<b>info</b>
<d>something</d>
<b>more info</b>
</a>
[Code]...
xml_object.childNodes.length will return the number of childnodes there are. But I don't see a way to get at the number of childnodes of a particular type. This will not tell me, for example, how many childnodes of type "b" that "a" has. I can't see Flash XML support being this sparse. Is there a built-in way of accessing the nth child of a node of a particular element name or am I stuck with accessing it only by number.
View 4 Replies
Nov 19, 2009
I have an external class in a .as file, my problem is that I can't access text box elements on the stage. Code like stage.txtfield.text or this.parent.txtfield.text does not work. The txtfield is the instace name of a Dynamic Text field.
View 4 Replies
Nov 23, 2008
I am trying to use startDrag to drag my square movie clip and while i drag it up the square should rototate right and when I drag down it should rotate left, everything works except of the rotation part
View 1 Replies
Feb 21, 2012
I am learning Adobe Air and want to get the current selected item in the spinner list I have created, however every time I use selectedItem I keep getting the same value over and over, no matter what option I select. I am trying to make an application for the Playbook and this this my SpinnerList code:
<s:SpinnerListContainer x="10" y="279" width="325" height="266">
<s:SpinnerList width="69" height="100%" enabled="true" labelField="data" selectedIndex="1" id="From">
[Code]....
No matter what, 'KM' is always shows as the selected item when it is not. This is what I have in the script tags:
var selected = From.selectedItem;
View 1 Replies
Nov 19, 2009
[code]Also pass the Stage reference still it not showing any error and text box is also blank,text is embed ed and the code is.[code]If I put import flash. display. List; it shows an error 1172: Definition flash.display:List could not be found.
View 5 Replies