Flex :: Factory Method Implementation To Attain Proper Object
Apr 9, 2011
I've got this issue implementing the Factory method. Following is the snippet of the the main chart class which calls ChartFactory's method to attain the proper object. I Type Cast chartobject so as to be able to call the Show method; I am apprehensive about that as well.
container = new VBox();
container.percentWidth = 100;
container.percentHeight = 100;
super.media.addChild(container);
chartObject = new ChartBase();
[Code] .....
My data is of mixed types like String, Array Collection, Boolean. I have to populate the data into appropriate UI component - for example Boolean to check box, Array to List. So we have created a factory class which will return 3 different type of component based on the input argument.
MultiLineCheckBox which extends mx.controls.CheckBox and few methods are overridden to bring the multiple line label. [URL]. It works perfect.Am using the MultiLineCheckBox in the entire application wherever I want check Box. Now I went into a scenario where I want check Box instead of MultiLineCheckBox. How to rewrite my CCheckBox to handle MultiLineCheckBox and also default CheckBox? Each of the CCheckBox class has lot of methods init.
I seem to recall that Loader.unload() could once be used to stop loading a swf before it had finished loading. I can no longer find documentation or the blog where I read this. Perhaps it was an unofficial feature. Anyhow, IModuleInfo, returned by ModuleManager.getModule() has an unload() method. If I want to halt loading a Flex Module that is in progress, do I just call iModuleInfo_instance.unload()?
Rather than use a hard-coded switch statement where you pass it the string name of a class and it then instantiates the appropriate class, I'd like to pass the actual name of the class to my factory method and have it dynamically create an instance of that class. I thought it would be trivial and am surprised it is not working. I must be missing something quite basic:
sample code:
createProduct(50, "Product1Class"); createProduct(5, "Product2Class"); private function createProduct(amount:uint, productClassName:String):void { var productReference:Class;
[Code].....
The only thing that may be a little odd (not sure) is that these "products" are actually linked Library items (ie: I have a movieClip in the Library that has a linkage to Product1Class and another to Product2Class both of which extend ProductBaseClass, which in turn extends MovieClip.
What I'm having the problem with is the proper usage of localToGlobal method. I have the hero mc, I put into it another mc called 'weapon'. Now, in the game, I want to fire a projectile and set it at the x and y of the weapon. The question is, how can I access the absolute x and y of the weapon.
I really need to send a variable via POST method to an URL and the navigate to it. navigateToURL sends variables using GET method, although I specified POST. URLLoader sends variables using POST method, but does not navigate to the URL.
I'm currently making my own shoot'em up game where the player can switch between two player types which will fire their own bullet type in this case, squares and circles. I've setup the player switch function via pressing "space" button (switching between the two player types) and the default bullet type is "squares" and I'm not sure to approach the coding with changing the bullet type to "circles".I've written 2 classes for the bullet and player setup:Player Class: Creates instance of bullet on screen and enables the switch player type function
Bullet Class: Enables bullet properies and bullet types Player Class: Code:function onKeyDown(event:KeyboardEvent):void {if (event.keyCode == 32) //// pressing/holding "space bar" to function
The thing is, this feels so basic, and Flash Developer Tool 3 is just giving me this nonsense error! I know, it's probably not really nonsense but... I want to create a simple video object and let it play a local flv. okay, here's the error:"call to a possible undefined method attachNetStream through through a reference with 'static' type Video"What does it means? Does it means the object Video is static, and it's not supposed to be? Or does it mean the attachNetStream is static? here's the function
Code: private function showVideo(e:MouseEvent):void { var videoConnection:NetConnection = new NetConnection();
I've been spending some of my spare time working a set of collections for ActionScript 3 but I've hit a pretty serious roadblock for the way ActionScript 3 handles equality checks inside Dictionary Objects. When you compare a key in a dictionary, ActionScript uses the === operator to perform the comparison, this has a bit of a nasty side effect whereby only references to the same instance will resolve true and not objects of equality. Here's what I mean:
how to send a word to the dictionary and get a true false result? I have a wordgame in mind. User selects letters and form a word, it would be great to send it to a dictionary - and then get a booloean return for the judgement and scoring. I came across the help which says AS 3.0 has a dictionary class.
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
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
is there any way to build html WYSIWYG in flex like Microsoft front page? i didn't found any thing on the web like this? second question is : is there any good rich text editor that support text completion function like ( like code IDE 's )
In my flex application I am using httpService to connect to the server, for the response from server I wanted it to convert the http response to flex object, Is there any remote implementation availabe for the above purpose
I have a Flex frontend connecting via RemoteObject to Zend Framework's Zend Amf. This is my only means to transport data between client layer (Flex) and the application and persistence layers (LAMP with Zend Framework).Some ways I can address security are as follows:
I can address TLS by using mx.messaging.channels.SecureAMFChannel in my services-config.xml file and ensuring Flash player is loaded into a HTTPS wrapper and is in fact using HTTPS since the AMF protocol is layered on top of HTTP RemoteObject has a setCredentials method with which I can pass AMF authentication headers to protect user related data. Assuming TLS was actually secure I can expose methods on the endpoint after authenticating the User.I can protect against cross-site scripting and other FLASH vulnerabilities with a properly set up crossdomain.xml how to I protect my endpoint against another AMF consumer? For instance, if there were another AMF consumer (not Flash so not bound by crossdomain.xml and Flash sandbox security) other than my Flex client that knew my endpoint, what would stop it from using methods that the endpoint exposes?
As far as I know I essentially need a way to authenticate my Flex application against my Zend Amf endpoint. After AMF consumer authentication, I have some of the security mechanisms I mentioned above to protect certain pieces of data (like User authentication). I can not embed some sort of authentication mechanism into my Flex swf because the swf is vulnerable to decompilation (the swf can not be trusted). While sensitive data is protected via User authentication the unprotected data is hardly public but as far as I can tell is totally open for public consumption.
i created project with flexmojos maven archtype..i used flexmojos:flexbuilder and compile/run with FlashBuilder 4 everything is okay but when i try to compile project with flexmojos i got following error: ERROR] Z:....srcmainflexMain.mxml:[6,-1] Could not resolve < fx:Script > to a component implementation.INFO] BUILD FAILURE
my mxml: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
I've got a custom CalloutButton component in a package called uiComponents. This custom CallOutButton is needed because I need some more properties in it. This CalloutButton gets added to my MXML like usual;
<uiComponents:MyCustomCalloutButton someproperties here > </uiComponents:My...>
Now, the enclosed s:calloutContent gets a compilation error, the (almost standard) could not resolve... Naturally, the namespace has been imported.
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.
I am looking for a Flex datagrid component that has features like grouping, sorting, master/detail display, etc. I am having an application in C# that uses XtraGrid suite to achieve the required datagrid features. I am planning to migrate this application to Flex. If there is no flex component readily available with XtraGrid features, then I have to create one on my own
I am trying to create a menu bar with the following items: File, Database, Navigate, Window. However, I am getting an error which I do not understand: Could not resolve <mx:XMLList> to a component implementation. Can anyone explain the error to me? My code is as follows:
I'm starting a Flex app on a pretty big reporting engine and want to know how best to connect to a Postgres Database. I'd like to create a REST API architecture so I can use the service for more than just the Flex app(mobile possibly).These are my options I've found:
I am having this error when I try to paste in code of a spark component. The component is a DataGrid and it needs to be a spark and not a mx.[code]The Error:Could not resolve <s:DataGrid> to a component implementation.How can I resolve this error. I need to make my DataGrid into a Spark Component.
Is model injection on the fly possible? In other words,if I ask for a model of the type IPhotoModel, I should get one of its implementations based on the current state of the view. If I am looking at a UserPage,I should get a user-specific implementation of that model.I am looking at a LocationPage,I should get a location-specific implementation.Currently, the only way that I see is introducing a command that specifies the model mapping, with a concrete one based on the current view state ...
injector.mapValue(IPhotoViewModel, injector.getInstance(UserPhotoViewModel)) or injector.mapValue(IPhotoViewModel, injector.getInstance(LocationPhotoViewModel))
is this the best way possible? I do not really want to introduce much coupling logic outside of the context, but ...