Flex :: Check If Clicked Element Is Inside Of IVisualElement (parent)?
May 27, 2010
I'm trying to check if a clicked element is inside of an IVisualElement in Flex 4. So I want something like "if this element is in this element, then execute function". I'm aware of the 'parent' property but this doesn't seem to work when my element is not a direct child of the element but for example 3 levels deep.
View 1 Replies
Similar Posts:
Jul 19, 2011
I have two swf file, A.swf and B.swf, each with its Document Class: B.swf is loaded in a MovieClip of A.swf. When loaded, B.swf creates an instance of CSDragger (it is a library object with its class extending MovieClip) and sets an ID property of this instance to a certain value. When this dragger is dropped by the user upon a MovieClip it sends a custom event containing the value of ID too. The custom event regularly reaches B.swf but never reaches A.swf. Aside from refactoring the CSDragger class (eg moving its handleDrop method in the B.swf document class), is there any way for the event to reach A.swf? I know I can intercept it and dispatch another event, but I was looking for a different solution (if any).[code]
View 1 Replies
Aug 26, 2011
I am dynamically creating 10 textinputs inside a vgroup . when user clicks a button, I want to fetch the text present on all textinputs. How to do this. My code looks like this
var vgroup:VGroup = new VGroup;
for(var i:number=0;i<10;i++){
var textinput:TextInput=new TextInput();
vgroup.addElement(textinput):
}
View 1 Replies
Oct 17, 2011
I am working on a sample map application using Flex 4/fxg? Now I have got FXG paths held in Group elements with id's( I have assigned path's id's to the corresponding group container)? But when I click anywhere in the map, I do not get the clicked group as target/currentTarget in event handler. How to determine which element is clicked?
[Code]...
View 1 Replies
Jun 3, 2010
I have three datagrids inside VBox container. Since I don't want scrollbar in my flex widget i am increasing the height of SWF through javascript, which increases with each addition of row in my datagrid. My query is how can I get the exact height of my VBox which is the parent element of datagrid. I am not able to get the height of VBox. I have tried to use measuredHeight,height with no success.
View 1 Replies
Aug 11, 2010
Say I start at a leaf node, and I traverse up the tree by using .parent(). I need an exit condition once it hits root. At the moment, I'm using parent.@name != "root", where name is just an attribute, but shouldn't I be able to check the type of element as well? How? Also, is there another way to end the traversal in as3?
View 1 Replies
Jul 20, 2009
I have XML that looks like this:
<question>
<type_elt>
<opt_out_flag />
</type_elt>
</question>
type_elt is not an element name; it might be <single>, <multiple> or something else, determined at runtime. How, given this, can I detect the presence of the opt_out_flag element?
I tried this (where xml refers to the question element):
if (xml.*.opt_out_flag) {
do_something();
}
but even in cases without opt_out_flag the above expression returns true. Obviously I'm missing something, but what is it?
View 5 Replies
Oct 14, 2011
I want to put an element into another component (in this case a print template), print it, and then return it to its place. The problem is that when I return it, it has the properties of the print template! Here is a simplified example. When you click print, the label is removed and then returned but when returned it is affected by the padding of the print template! Why? How can I somehow refresh it to its proper properties? I tried all the invalidate... methods and parentChanged() but nothing worked.
[Code]...
View 2 Replies
Oct 5, 2010
How can I check what the parent of a displayObject is? What is the parent of myObject for example.
View 1 Replies
Jan 19, 2012
I need to access information in my XML. The information I need is not stored on every object in my XML, only on the parent. But how can I check if there is a parent or not, so it wont throw an error when selecting the first object in the tree (having no parents)?
[Code]...
View 1 Replies
Mar 18, 2012
I know that there is no such function as getElementByName in Flex but I also now that you can do this["object_id"] to get the element of the application u're in.What about getting an element inside another element?I've tried making element["id"] ? But in my try-catch it always runs the "catch" part..how do I get an element inside another element just having it's id in dynamically created string form?
View 2 Replies
Aug 20, 2011
I have the following:[code]I want to display a tooltip on the img element - haven't figured this one out - ideas anyone?
View 1 Replies
Oct 21, 2011
I have the following function in Flex 4:
[Code]..
Isn't there a way to loop over each image in the hgroup and add the eventhandler? Something like this:
[code]...
My teacher told me this isn't possible but in case of 10+ images, I can't imagine doing it for every image separately. There has to be a better way to do this, no?
View 1 Replies
May 19, 2010
I I have a view in Flex 3 where I use a tab navigator and a number of views inside the tab navigator. I need to be know which view was clicked because of it's one specific view then I need to take action, i.e. if view with id "secondTab" is clicked then do something.
I have set it up to be notified, my problem is that I need to be able to know what view it is. Calling tab.GetChildByName or a similar method seems to only get me back a TabSkin object.
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
[Code].....
View 2 Replies
Feb 4, 2010
Recently I worked in a project using Flex. Its a Photo editing project. I have took a Canvas and take a image in that canvas using the code canvas.addChild(image) . Now i can move the image freely by using moving code. The image move inside the canvas and outside the canvas. I want to move the image/child only inside the canvas not outside. How can i do this?
View 1 Replies
Aug 10, 2011
I'm trying to create a virtual keyboard.
I have a class VirtualKeyboard which contains an array called keyboard of 26 movieclips, each one representing a letter.
In the main class, I create an object of the class VirtualKeyboard and added an eventlistener on it when a letter is clicked.[code]...
But the index always returns the value 4294967295.
How can I know which letter was clicked, I mean the index in the keyboard array corresponding to that letter?
The same code is working correctly if I put it in the VirtualKeyboard class, but not from the main class.
View 1 Replies
Dec 9, 2009
I have several array element each assigned to different symbols on the stage and now I have assigned one function (fcn1) for each element's MOUSE_OVER event as follows:.
for(h = 0; h < fields.length; h++)
{
fields[h].addEventListener(MouseEvent.MOUSE_OVER, fcn1);
[code]....
Now in fcn1, I have to identify which element the mouse was over it. I could not do this because I can't pass any parameter to fcn1 other than e:MouseEvent. And I tried to look the properties and methods of e:MouseEvent that might give any information about the source element (in this case, array elements).So far, only way out of this was I create function for each array element which in turn call fcn1 with appropriate parameter, but it is cluttery.
View 1 Replies
Aug 10, 2011
I'm trying to create a virtual keyboard
I have a class VirtualKeyboard which contains an array called keyboard of 26 movieclips, each one representing a letter.
In the main class, I create an object of the class VirtualKeyboard and added an eventlistener on it when a letter is clicked.
I tried this in the event handler :
var objectClicked:Object = event.currentTarget;
var index:uint = virtualKeyboard.keyboard.indexOf(objectClicked);
But the "index" always returns the value 4294967295
So how can I know which letter was clicked, I mean the index in the keyboard array corresponding to that letter?
The same code is working correctly if I put it in the VirtualKeyboard class, but not from the main class
View 1 Replies
Jan 3, 2012
Say, I have an array of movie clips (dummies). Each dummy has an event listener and reacts to clicks. And when a dummy is clicked, I want to know the index of the clicked dummy.
I've only come up with this solution: run through the whole array of dummies and find out which dummy is the target, then exit the 'for' cycle and assign some global variable the value of counter variable, but this way the application I am building will demontsrate poor performance.
View 2 Replies
Sep 2, 2004
I have an array of movie clips (dummies). Each dummy has an event listener and reacts to clicks. And when a dummy is clicked, I want to know the index of the clicked dummy.I've only come up with this solution: run through the whole array of dummies and find out which dummy is the target, then exit the 'for' cycle and assign some global variable the value of counter variable, but this way the application I am building will demontsrate poor performance.
View 12 Replies
Dec 2, 2010
I want to check if the element in this structure exists for each child. The problem is that the children don't have the same name (product,prepack) and I don't want to change the order. Additionally I can't change the XML structure.
[Cdoe...
View 3 Replies
Nov 11, 2010
Whats the best way to check if the mouse is over a particular element?
View 1 Replies
Jul 3, 2009
In below class I ave declared an array "selectedOptions". In click event Im storing the values in it. But everytime I click on the object the array gets initialized and stores the clicked element rather storing all the elements one by one. Could you tell me the reason?
[Code]...
View 8 Replies
Jan 25, 2007
How do I check if an element in an array exists?
I'm looking for something along the lines of this, but don't know the proper syntax:
ActionScript Code:
if(array[5].exists()) {
// Do something.
}
else {
// Do something else.
}
View 8 Replies
Feb 18, 2009
Well, I looked at the example, and looks like that was still not what I wanted. Interestingly, I took the middle for loop out and now it appears I am not having issues anymore.[code]
View 7 Replies
Feb 4, 2005
is there a way to check an array to see if an element has already been added? I'm working with an XML document where there are 4 possible variables, but these 4 vars are repeated several times over. It's reading in fine... I just want to pull those specific variables out of the XML and add them to an array, but I do not want them to duplicate. To say it another way... I don't want my array to be more than 4 items long (it is possible to be less) with a max of those 4 different vars.
View 1 Replies
Feb 4, 2005
is there a way to check an array to see if an element has already been added? I'm working with an XML document where there are 4 possible variables, but these 4 vars are repeated several times over. It's reading in fine... I just want to pull those specific variables out of the XML and add them to an array, but I do not want them to duplicate.I don't want my array to be more than 4 items long (it is possible to be less) with a max of those 4 different vars.
View 1 Replies
Jan 25, 2011
I need to display something on my program just for one month. For example from the 1/25 to 2/25 I need to display something but at midnight on the 2/25 the the element has to disappear. I need to create a function to do that but I have no idea how to check the date. a lot
View 3 Replies
Jan 31, 2012
I'm using a multi-dimensional array (openImage[]) to track the open images in my multi-dimensional array (Images[]).
I would like to check and see if an element in a multi-dimensional array exists before I access it because there are rare occurrences where the data in openImage[] is not valid. I keep on getting errors every way I've tried it.[code]...
View 9 Replies
Feb 2, 2011
this one's driving me crazy. I've got a button embedded in a MovieClip. When the user clicks the button (from the stage level), I want to return what MC the button's parent is, so that I can pull some variables from the parent.
HTML Code:
public function buttonClicked(e:MouseEvent)
{
[code].....
View 1 Replies