Flex :: Move Dynamic Child Or Element?
Dec 25, 2011
It's possible to move a dynamic ctreated element or child? Example:
Create childs:
public function createChilds():void {
for(var i:int=0; i < 10; i++) {
newImage = new Image();[code]...........
View 1 Replies
Similar Posts:
Jun 30, 2010
I have spent 2 hours on this simple state to state transition with simply resize and move animation. I can get the element to move and fade...but there is no resize animation at all. The panel element stay the same width whole time. If I copy the code to a brand new test mxml file, it works, but not in my main application file.
[Code]...
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
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
Jul 18, 2011
i have a question while reading Flex 4 Cookbook i came across the method to dynamically adding control to the container controls but nowhere i came across with how to provide them with the dynamic properties and events like they have created a button dynamically inside a group control but what good a button be if i cannot give it an event dynamically. in the same way i want to add a tree view inside a vbox but what good that be if cannot provide a data provider to it dynamically.actually i am creating an web application where i add the tree view to a vbox and i want to the data provider should also be dynamic depending upon the option i have selected in the combo box.
View 1 Replies
Sep 9, 2010
I have a very interesting challenge here for my Flex project development. I now have an experiment wizard which consists of three states.In the first state,the user selects the elements they are interested from the periodic table. When it comes to the second stage,now we have the elements that the user selected in the first state,and these elements are shown on a list A',the user can select an element from there. Also,I have an xml file that has the intensities and wavelengths for all the elements in the periodic table
[Code]...
View 1 Replies
Jul 20, 2010
I created a form dynamically by adding each component in action script,now i want to get back the text/data entered in to that each component dynamically?[code]...
View 2 Replies
Mar 2, 2012
I am writing a program where the user can, in the simplest terms, drag and drop things on to the stage. I need the user to be able to save what they have done and when they come back choose to reload their previous project. My plan was to write all the information(object class, x and y values etc) to an xml file and when the user chooses to load a particular project, rebuild the stage with all objects in their correct locations. My problem is, how do you add an xml element with all of its attributes and child elements dynamically for each object added to the stage?I'm relatively new to XML, but I figured this would work:
ActionScript Code:
var test:XML = <test/>;
test.title = "Test XML";
for (var i=0; i<platform.numChildren; i++) {
[code]....
in a for loop as well. But, these give me a warning that says "adding an element with more than one item is not supported" or something like that.
View 0 Replies
Jan 16, 2012
I am trying to insert child node in xml via actionscript as follow -
var xml:XML = <menu>
<item>burger</item>
<item>soda</item>
[Code]....
moreover it returns undefined and as described in actionscript livedocs -
If you call this method on an XML child that is not an element (text, attributes, comments, pi, and so on) undefined is returned.
View 1 Replies
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
May 12, 2010
I have created 2 sprites each containing a dynamic text field child. I then add this as a child of the stage. (I have done this in order to make the text clickable with a hand cursor on mouseover)It loads in fine, I just run into problems when trying to REMOVE it the sprite containing the text."ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller."Sections concerned in red:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
[code]........
View 2 Replies
Feb 15, 2012
I know that I can access an XML Element with tag name 'page' like so:
xml_variable.page[i].toString();
This is not what I want, however.
What I want to do is access the XML Element with the tag name equal to a String variable in Actionscript:
var page:String = getCurrentPage();
xml_variable.page[i].toString());
I've done this in javascript and am wondering if it is possible in Actionscript 3.
View 1 Replies
Feb 20, 2009
I have a menu with three buttons and a head "scene" where i present my information. When I push a button in the menu three small pictures are shown on my "scene". Each picture should show a bigger version of the picture and here is the problem. The first picture is shown and it is possible to make it disappear with removeChild. But how do show the other two pictures?! I have tried to do the same as i have done with this picture but with no success.
function visaGolf(e:MouseEvent){
var headBtn:MovieClip = new btn();
headBtn.name = "headBtn";[code]....
View 0 Replies
Jun 10, 2009
I am having a problem with a flash piece that I created. I don't understand why it is doing what it is doing. I am new to flash but I have been developing software and database applications for over 10 years.I am trying to make a horizontal scroller piece that reads in data from an xml document. So basically the XML has properties of image, title, and link, I then load the images and titles into an object spaced out properly and link the image to open a new window when the image is clicked. I have 4 layers:
1. Actions
2. Buttons
3. Layer1
4. Scroller
The buttons layer has 2 buttons on it, one left aligned and one right aligned. When you mouse over the buttons, the images in the scroller move the direction the button image is pointing. The Scroller Layer has an object of type scroller (which i made) and that scroller instance name is scrollerbar.In actionscript I use a sprite object to load the image and then use scrollerbar.addChild(photo) to add the sprite into the scrollerbar. Then I set it's width, height, x and y to be in the correct position.Now when this first runs, it works displays 6 images and titles and they are linked, and has a button on the left and right. When I mouseover either of the buttons, everything gets moved to the right, the buttons, the scroller, and all the images inside the scroller. So the left button is no longer against the left side, and you can hardly see the right button because it almost gets pushed outside the viewable area.Can anyone explain why everything is getting pushed over like that? It only happens the first time you mouse over a button, subsequent mouseovers of either button do not cause this to happen again.[code]
View 2 Replies
Apr 25, 2011
How to get all child ids of myCanvas1.Also for a specific mxml tag say <mx:Move /> how to get its id from action script
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[code]....
View 2 Replies
Jan 23, 2012
I have a dynamic class, which has an array declared normally, before runtime.Usually, you can dynamically access a variable, whether it has been declared or not with
myClass["variable"] = 4;
however, trying to do this with an array, like so
myClass["array[0]"] = 4;
does not store 4 into the first element of array, and instead stores it into the variable "array[0]". For instance, after executing the previous code,
trace(myClass.array[0]);
traces undefined, where as
trace(myClass["array[0]"]);
traces 4.
Is there anyway I can access the elements of the array dynamically?
View 1 Replies
Aug 23, 2010
i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application
<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....
when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?
View 1 Replies
Dec 26, 2011
I'm having a hard time working out the most appropriate way to move a child movieclip between parent objects.
I'm creating a board-game type game wherein I've dynamically created an array of 'Square' movieclips, with no visual elements, which are arranged in a 10x10 rectangle on the stage. I then dynamically add the appropriate types of piece movieclips to the various squares with the addChild() method. In general, a square should only have one child piece at a time.
All of this works well for setting up the play area, but now I'm having an issue with moving a piece from one square to another. I want to have the user click a square with a piece on it, then click the destination square to move the piece. I have the logic for determining where a user can move any given piece to, but I don't know how to actually move the piece.
The pieces are all different class objects that extend both a base class I call Piece as well as the MovieClip class. The main issue is that when dynamically adding the various pieces to the squares, I don't provide them a unique name to access them later. I don't bother with unique names because I have no way of knowing which piece instance will be in a given square, so using getChildByName(name:String) isn't very useful.
So I can think of two routes that I can take: Making a getter/setter for the Square class that manages a private Piece property (as well as the adding and removing of the child piece to/from the parent square), or using getChildAt(index:int) to try to access the child piece.
I want to go with the first route as it seems to be the most maintainable to me. My problem is that I can't work out how to manage empty squares in this scenario. My instinct is to null to private _piece property of one square once I've moved the child piece instance to another square... but I'm fairly certain that the private property is a reference type, and nulling it out will null the actual piece object even after it's changed parents.
View 1 Replies
Mar 10, 2010
var viewStack:ViewStack = new ViewStack();
viewStack.percentWidth = 100;
viewStack.percentHeight = 100;
[Code]....
Its only displaying canVas3 contents not canVas1 and canVas2
View 1 Replies
May 10, 2010
I have a component mxml file in which i have a view stack, on click of a button i navigate to the first child, now i need to navigate to the second child during onclick of a button present in the second child. All the childs are component files included within the view stack. How could this be done, Sample code is present below,
[code]...
Now in my offering.mxml file if i try to access navigationViewStack i am getting an error stating 'Access of undefined property navigationViewStack.
View 3 Replies
Dec 16, 2010
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?
View 2 Replies
Sep 27, 2009
I have a bunch of objects that each contain a color swatch movie clip. The color swatch contains a bunch of frames, each a different colored rectangle.The objects that contain the swatch clips also have a mask layer that defines what portion of the color swatch is revealed.
When I have one frame in that mask, everything works correctly. I can change the swatches with no problem.However, I need to create different frame for the mask. Once I create a second frame with a different mask, I get a Null Object Reference and everything breaks.
I tried creating shape tweens between the frames, making each mask into its own movie clip, and putting each new mask on a different layer - but none of that works.
View 1 Replies
Jun 25, 2010
I have a parent and 2 children. I am trying to pass data from child1 to child2 but keep getting an error message: 1061: Call to a possibly undefined method through a reference with a static type.
In child1 I have the following code:
[Bindable]
public var TestVar:String='sometext';
In child2 I am trying to get the value of TestVar and then use it as a value to search a mysql database via php.:
var newTestVar:String = child1.TestVar;
if(newTestVar != null){
getResult.token = someService.get_filtered_Paged(newTestVar);
[Code].....
View 4 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
May 10, 2010
I have flash where there is a link for song download. And, at the bottom of the flash I've a count, loaded thorugh flash vars which should increment everytime donload button is hit. Please let me know what approach should i take to do that. can i call a Java method on donload button which will insert a row in the table and and then get the count and render it to the count variable in my flash?
May be this extremely confusing. Here is a very similar example on how it is done. This is actually very similar to what i want to do. [URL] on this link there is count below which increments you hit the download button.
View 1 Replies
Oct 22, 2010
I have a Adobe Flex project in which resides the following layout markup.
[Code]...
But that does not work. In fact, when debugging "b" is always null even though "grid.getElementAt(0)" returns a BorderContainer.
View 1 Replies
Oct 25, 2010
I've built a rather robust tooltip class recently that attaches and draws a single tooltip sprite to the root, then uses MOUSE_OVER to detect when it is over a tooltippable object, and shows the appropriate tooltip text. At the moment, I'm ensuring that any elements in my application which wants to take advantage of showing tooltips implement the ITooltippable interface, and expose a public getter, get tooltip().
[Code]...
View 0 Replies
Apr 13, 2006
Basically I have 14 text boxes, each box draws its content from an external txt file. Next to each text box is a button. I want the button to be either visible=true or visible=false depending on weather or not the text box has content or is "undefined" Here is what I have so far, and it's not working:[code] I would like a FOR loop to just run through the variables and check to see if any of them are undefined. if it is, then make the correct send button invisible.
View 8 Replies
Aug 18, 2009
I have an array like this
public var dataAL:Array=[
{Kiv:"cash", jan:26,janTarget:28,feb:27,febTarget:26,mar:30,marTarget:32,apr:31,aprTarget:32,may:28,mayTarget:29,jun:46,junTarget:32,jul:37,julTarget:39,aug:40,augTarget:42,sep:41,sepTarget:42,oct:48,octTarget:49,nov:40,novTarget:41,dec:38,decTarget:40},
[code]....
Now if i want to access febTarget for cash how will i do it?
View 1 Replies
Dec 15, 2011
I've got a spark list that gets dynamically filled.So far the new items appear at the bottom of the list. What I'd like to do is to add them at the top.The items in the list have a unique ID so some kind of sorting mechanism would probably do the trick as the new items have a greater ID than the old ones.What I'd like to avoid is some complex method behind this as I'm working on a mobile platform and the list can get quite big so I need this to be as efficient as possible.The list's data provider is an ArrayList that gets updated using binding.
View 1 Replies