Actionscript 3 :: Setting Property Of Object In Flex?
Dec 2, 2010
<mx:Canvas id="maincanvas" backgroundColor="7000" width="100%" height="100%">
<mx:TextArea backgroundAlpha="0"/>
</mx:Canvas>
However if I try creating a new textarea object via:
var textarea:TextArea = new TextArea ();
textarea.backgroundAlpha = 0;
maincanvas.addChild(textarea);
flex throws the error :
1119: Access of possibly undefined property backgroundAlpha through a reference with static type mx.controls:TextArea.
View 1 Replies
Similar Posts:
Sep 30, 2009
I'm trying to convert an MXML component to an ActionScript Class. The component consists of a Form with a TextInput, TextArea, and two buttons - Save and Cancel, and a Validator for the TextInput, and other logic to handle events that occur. This component is currently extended by several other components. Now, in the MXML component binding the TextInput text property to a property in an Object was very easy:
<mx:TextInput text="{_itemToEdit.name}" />
But in ActionScript, I'm creating the TextInput and setting the text property before the Object is set, and the TextInput is not being updated:
public var itemToEdit:Object = {};
private var nameInput:TextInput = new TextInput();
public function MyClass() {
nameInput.text = itemToEdit.name;
}
How can I make sure that the TextInput text property is bound to the specified property in the Object?
View 4 Replies
Jul 26, 2011
Setting the text property of a flex DateField makes the selectedDate property of that DateField go to null.I need to set the text property so that I can use a particular format (DD-MMM-YYYY).
View 2 Replies
Nov 24, 2009
I seem to be having a recurring problem attaching events to a button i have created within 2 other movieclips.I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
So it looks like it can't find the button, in order to attach the event listener. The question is why? I am attaching a similar event to a button on the main timeline and that works fine. So it looks like a scope issue, but I am referring to it properly.
code below:
Code:
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.display.*;[code]................
View 6 Replies
Jun 17, 2011
I'm looping through a recordset, and for each item I create at runtime a spark Label and set the text property from a field of the recordset. The labels must have a fixed width and some text goes multiline. I want to arrange the label vertically so I need to know the height of the label so I can place the next label properly, but when I try to read this property, after the labels is added through the addElement mehtod, it returns 0.
how to get the label height?
View 1 Replies
Jul 20, 2011
I am using the combocheck example from the following site: [URL]
It's a very useful component and works very well.
Now, I need to set the text property of this combo box upon application startup with certain values (which are defined dynamically according to some criteria). The problem is that although I have no problem setting the text property of the combo box at other times of the application run, setting the property at startup seems to have no effect unfortunately.
For example, I want to set the text property of the combobox to "Bob" (which is one of the items in the dataprovider for the combobox) and the "set text" method is called on the combo box. Performing a step-through shows that the "set text" method is receiving the correct value item but not setting the _text property.
I have tried not doing anything until "ApplicationComplete" but no joy there either.
Here is the code (a combination of the code from the URL above and some other changes to it). However, as I've stated above, the codes does work. The problem is that it doesn't work at the application startup. Whenever an event is fired and setComboText is called as a result, the text of the combo box is set correctly.
private function onComboChecked(event:ComboCheckEvent):void {
var obj:Object=event.obj;
var index:int=selectedItems.getItemIndex(obj);
[Code]....
View 2 Replies
Feb 22, 2011
I'm having trouble setting up a Graphic object (a solid filled rectangle) to be masked with an image that gets loaded at runtime. I've managed to get it to work with the following code:
<?xml version="1.0"?>
<s:Application xmlns:fx="[URL]"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
[Code] .....
Setting the PNG inside the <s:mask> makes the stage render nothing, while adding the mask programmatically in the init() method causes correct behaviour. It took me quite a while to figure this out and I'd like to understand what it is that I'm doing incorrectly in the MXML approach, as that seems to be what is being done in the Cookbook (other than me using an Image and the example using a Group wrapped BitmapImage).
View 1 Replies
Oct 27, 2011
My problem is to find out the object which owned my property... for example:
My Class :
public class MyClass{
var myGroup:Group; //Spark Component
.....
}
Now, I add my Group to another UIComponent. Next step in Class XYZ I wan't to get my MyClass Object ... but I can only see the var myGroup
public class XYZ {
...
public function getObject(group:Group):MyClass {
return group.????;
}
...
}
View 1 Replies
Nov 25, 2011
[code]...
The labels text will be "Property", but if object.property is changed, the label isn't updated. Is there any way around this?
View 2 Replies
Oct 12, 2011
I have a dynamic Actionscript class as follows: public dynamic class Foo {....} In my code I (may) add some properties to it: myFoo["myNewDynamicProp"] = "bar"; Elsewhere in my code, given an instance of class Foo, how can I determine if that dynamic property has been added already without throwing an expensive exception?
View 4 Replies
Nov 16, 2009
I am working in air application , i need to know how to add event listener when any object is updated,how can i implement this.Example:i have Class name Vehicle, and child class are Car,Bus,Bikes,Scooter,..etc, child class also have many properties like color,model no,....etc
I have array collection and AddChild() method in Vehicle class by this, i will add, child class to the vehicle class.I need a event listener which can trigger if any of the property is updated or changed in any of the child class property, how can i implements this in Flex3.
View 2 Replies
Mar 22, 2010
I'm trying to assemble a header object for an api request. One of the headers is 'Content-Type'. The hyphen is causing a compile error. Flex is giving me:
1050 - Cannot assign to a non-reference value.
I find it spiteful that they enjoy the use of a hyphen in the error message while I hang my head and come here for answers.
View 1 Replies
Apr 22, 2010
I have a dynamic class that I have created
public dynamic class SiteZoneFileUploadVO
{
public var destination:String = "sitezone";[code]...........
when I try to iterate over this object's property names it only iterates the dynamically added properties.
parameters.dynVar= "value";
for(var name:String in parameters)
{
Even though the object has all the properties equal to a value (ive checked this in the debugger) the only property name that will be traced is dynVar.How can I iterate over all the property names and not just the dynamically added ones?
View 3 Replies
Dec 3, 2010
I need to create variable object property names for use with the data grid component.
This works: data = new Object(); data.some_name = "the data";
But this does not: data = new Object(); colName = "some_name"; data[colName] = "the data";
View 3 Replies
Nov 2, 2009
I have a PresentationModel AS class that holds all the values used in SomeView.mxml. The entire class for the model is bindable, and the model property in the view is also bindable. However, I am unable to inject the model into the view using the PropertyInjector tag:
- INFO: Data binding will not be able to detect assignments to model
MainEventMap.mxml
<EventHandlers type="{FlexEvent.INITIALIZE}">[code].....
View 2 Replies
Sep 4, 2010
I try to do preloder in Flex for my project written in Flash. I make this with the help of this site link text My Flash project have next source in main class called Game
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
private function keyDown(event:KeyboardEvent) {
[Code]....
Flex application work but Flash application does not react to button presses
how I can make preloader and work buttons together
View 2 Replies
May 29, 2009
I've got an object that contains a dozen or so fields I want to bind to form elements, so that I can use that object to send the data back to the server to be saved.
[Code]...
View 6 Replies
Mar 5, 2010
I am using shared object to share data between two users. First user connect to shared object and set some value in shared object. Please consider that second user has not connected with the shared object yet.Now when second user connects to the server and try to get that property set by first user, he could get shared object but could not get properties of Shared object set by first user. I observed few times that Second user can get these properties within "Sync" event between two users. But I would like to get these values for Second user in any stage (i.e. in load event etc.). Whenever Second user tries to get the property of Shared object, the object will reset the actual property value and then return reset value.
1) Is there any way to get all the properties of shared object before sync event called, as I want to get it immediately when second user connect to the application and perform next task based on the values stored in shared object.
2) Is it possible for second user to check whether any property has been set by first user? So that second user can use the property instead of reset it.
View 1 Replies
Aug 8, 2010
I am building a AS3 only project and got runtime error that said "Cannot access a property or method of a null object reference."
Here is my code:
main.as
public class videoMain extends Sprite{
private var videoPlayer:Player;
public function videoMain (){
[code]....
View 1 Replies
Jan 23, 2009
TypeError: Error #1009: Cannot access a property or method of a null object reference have a mxml file that has actionscript inside of it, I'm trying to call a function in a button outside of this actionscript in the same mxml file. I'm calling the public function cancel(); like this click="cancel();" but i'm getting an error 1009 that I can't access a property or method of a null object reference
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox
[code].....
View 5 Replies
Dec 2, 2009
I changed my html template to include flashvars like so:
if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
[code]...
And I am trying to access them in my app like so:private static var _PID:uint = Application.application.parameters.product_id;
But I am getting this error:
Error #1009: Cannot access a property or method of a null object reference.
View 2 Replies
Apr 16, 2010
I was trying to create these 17 textfields in a for loop. I ended up instanciating them manually and now I am trying to set some of their properties in a for loop. The problem is that when I trace them I just see [object textfield] but not the names. If I try to trace the ".name" I get instance 1, instance 2, etc. The real problem is when I try to set the "y" property I get an error "1010 A term is undefined and has no properties"
Code:
var tf1:TextField = new TextField();
var tf2:TextField = new TextField();
var tf3:TextField = new TextField();
[code]....
View 4 Replies
Apr 11, 2012
I am trying to use a button in my init() method.
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Test"
creationComplete="init()">
Now when I try to do something with my button I get the error mentioned. I am assuming maybe it has not loaded yet?
[Code]....
View 1 Replies
Nov 26, 2009
I have a flex application which use DragManager.When I'm loading this application into flash application and trying to use drag'n'drop functions - I get an error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.managers::CursorManagerImpl/showCurrentCursor()
at mx.managers::CursorManagerImpl/setCursor()
at mx.managers.dragClasses::DragProxy/showFeedback()
at mx.managers.dragClasses::DragProxy/mouseMoveHandler()
But, when I simply run a flex application (not loding it into a flash one) everything works properly.
View 1 Replies
Nov 8, 2010
This marks a new chapter for me asking a question about an entirely different subject that I know nothing about I'm following a book called "Flash Games" and it's not for beginners and I'm a beginner so lots of jargon that I don't know and simple google searches don't come up with anything. What is the Flash IDE? Does this author mean the application Adobe Flash to build applications. So that means there is Flex, and Flash Catalyst, and Air IDEs? I don't really treat this like IDEs in terms of programmer but I guess I just don't know. The author says to set the document property on my file.fla to Game. How to do this?
View 2 Replies
Oct 8, 2009
I am adding some XML nodes clip_mc to my box0 movieClip and I am not able to figure out how to give them button property.[code]
View 0 Replies
Aug 31, 2004
ive got a radiobutton component on my stage named radio1. I need to duplicate it and then change a few properties, but i cant seem to get the path/naming right. This is my code:
Code:
i=2;
radio1.duplicateMovieClip("radio"+i, radio1.getNextHighestDepth(), {_x:20, _y:20});
_root["radio"+i].setLabel("test");
i++
if i use a constant name instead of "radio"+i it works but the ["radio"+i] seems to be the problem, could someone help me with this? (using flash mx)
View 7 Replies
Nov 1, 2003
I used the following code to read a file "images.txt" and build a movieclip by loading the images specified in the file.
I wanted to make this dyanmicaly built movieclip invisibe. i.e "setProperty (_root.preloader['part'+count], _visible, false);" line in my code below is not working.
[Code]....
View 3 Replies
Apr 1, 2010
Short version:Setting a TextField's 'text' property seems to be quite slow. Any way to optimize this?Long version:For a video player I'm working on, I've rewriting a bunch of code I've written in the past and optimizing where I can, and I've noticed something a bit strange.I have a time readout (the typical "00:00 / 01:00" thing) that I'm updating every frame, and it seems to be gobbling up FPS (I'm using mrdoob's great little Stats class for monitoring).The thread to make the call is a bit heavy -- involving a dispatched custom event from the FLVPlayer class (with the current netStream.time as a property) onEnterFrame, which is passed up 2 parents and then back down via a function call -- but I've isolated each step along the way and everything is totally fine (running at or close to 30fps) right up until that very last call where I set the TextField.text property, which results in about a 10fps drop.
If I comment out the setting of TextField.text it runs great, but even if I set it to something arbitrary (like currentTime.text = "0") -- bypassing the reformatting math -- it just tanks.Anyway, anyone know if there's something I can do about this? I've considered using a Timer set to 100m instead of onEnterFrame, but I actually assumed the overhead would come from the dispatching of and listening to the event as well as the reformatting of the time, but *not* the very last step of setting the .text property, which is something I can't avoid whether I use a Timer or onEnterFrame.
View 1 Replies
Nov 1, 2003
I used the following code to read a file "images.txt" and build a movieclip by loading the images specified in the file. I wanted to make this dyanmicaly built movieclip invisibe.i.e "setProperty (_root.preloader['part'+count], _visible, false);"line in my code below is not working.
[AS]
var count = 0;
var offset = 0;
[code].....
View 3 Replies