Flex :: Base Class For Custom Components
Dec 9, 2009
In my flex app I have various custom components done with mxml or actionscript.I want all of them to extend a base-class where I can define properties/event listeners etc.Can someone give me an example how to create that base class and how I can extend it in mxml and actionscript components?
View 3 Replies
Similar Posts:
Sep 8, 2009
I am created a dynamically adding a VBox, that contains two images. Into a Custom Component that is derived from UIComponent. The problem is the Vbox that contains the two image is only a really tiny size. I would like the VBox stretch to the size of the two images. This is how I am creating the Vbox....
[Code]...
View 1 Replies
Oct 13, 2011
I'm working on a iPad game in Flash Pro CS5.5 and it was compiling correctly. Now I have marked a lot of MovieClip classes for Export for Actionscript so they use a custom MovieClip subclass as base class.
When publishing the movie I get a SWF without any actionscript in it (publishing takes also a lot less time then before). Now I have a suspicion this is because there seems to be a limit on the number of Export for Actionscript you can have?
The problem is that for iPad I can not split my .fla to create multiple swfs; since swfs that you load via the main document can not have any ActionScript in it (I tried already to put all the sounds in a seperate SWF with export for actionscript turned on, that didn't work).
View 7 Replies
Aug 26, 2011
I'm using several custom MXML components in my Flex 4.5 application.They all use absolute coordinates to place Image, Label, Line, etc. components and are currently based on a spark.components.BorderContainer:
<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer
xmlns:fx="http://ns.adobe.com/mxml/2009" [code]....
Then I've realized, that I probably don't have to use BorderContainer, because I don't draw/need any borders around my custom components.But I don't know, what to take instead of it.I've tried taking <mx:UIComponent> (and removing <s:Layout> tag above), but then I get the error:
'Image' declaration must be contained within the <Declarations> tag since it does not implement 'mx.core.IUIComponent'.
'Label' declaration must be contained within the <Declarations> tag since it does not implement 'mx.core.IUIComponent'.
Is there some simplest possible spark "container"? And do I need a "container" at all if I use (and want to use) absolute coordinates?
View 1 Replies
Feb 9, 2010
say that i have a base class called Base, that is Bindable and has a String property like this:
[Bindable]
public class Base
{
public var msg:String;
[Code]......
where msg is some textInput field. I am getting a message from the compiler that....
Data binding will not be able to detect assignments to "msg"
is there a limitation with data binding to a base class?
View 1 Replies
Oct 9, 2009
Make a custom preloader for the whole project, in a class, is that possible? Is that a good idea to creat a custom class for the Menu or other components like Background, etc?As I read in the book "Essential ActionScript" it's ok to make custom classes and organize everything, catching the errors in isolated form , turns it easy to manage and update..How to organize the classes?
View 5 Replies
Jan 4, 2010
I have a BaseComponentClass that I am using as the class that all my custom components extend.For some reason, none of my custom components show up at runtime. I am not getting any compile or runtime errors either.I am implementing all the protected UIComponent methods.[code]The Button never shows up at runtime.
View 3 Replies
Nov 25, 2011
I want to create a custom component library. the components are customize-able during creation time. means like Accordion or TabNavigator, when we drag and drop the Accordion in flash builder it
<mx:Accordion x="38" y="167" width="200" height="200">
<s:NavigatorContent width="100%" height="100%" label="Accordion Pane 1">
</s:NavigatorContent>
[code]....
View 2 Replies
Apr 15, 2012
I'm trapping keyboard events on the stage and dispatching custom events through a framework (Mate, though I don't know that this is an important issue), but I'm pretty confused by the scope. The structure is:application (traps keyboard events and dispatches custom event mainPanel (receives dispatched events but mainCalendar (a child element) is null on debugging. Obviously if I try to call a public method on mainCalendar it errors out, even though it's a child of mainPanel. However, mainCalendar is NOT null IF I use FlexGlobals.topLevelApplication.mainPanel.mainCalendar. Outerdocument and parentDocument do not expose mainCalendar either, BTW mainCalendar (a custom component inside mainPanel with public methods. Creation policy is 'all' and it's visible and exists long before I trap any keystrokes at the top level)Could someone take a minute and explain why the mainCalendar is out of scope when mainPanel receives a custom event, even though mainCalendar is a child of mainPanel. Is there a better way to manage the events so I don't have to always address the component via the topLevelApplication?
View 1 Replies
Oct 2, 2009
I am trying to create a component which can receive an additional value from mxml [code]...
View 6 Replies
Jun 21, 2010
When I define custom propertie in my MXML component, I also want to define a set of possible values of that property to make Flex Builder show then (possible values of the custom property) when I invoke code completion function.
View 2 Replies
Jan 11, 2010
I am using a custom component within another custom component in a flex mxml application file.Is it possible to bubble events from an inner component to the outer component and handle events in the outer component?
View 3 Replies
Jul 18, 2009
Is there a way to write a custom event that gets triggered when the user clicks outside of that custom component instance? Basically anywhere else in the main flex app.
View 2 Replies
Dec 11, 2009
I've written the following custom component, SubNavBar.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" height="100" width="300"
creationComplete="init()">
<mx:Script>
[Code]...
Whenever the trace function runs in init(), the property menuItems returns null. I don't seem to have this problem with other variable types, like Boolean or String. Is this due to the size of the XMLListCollection object? How can I set up this SubNavBar custom component with XMLListCollection property and bind it to a control in the component?
View 2 Replies
Jul 1, 2010
I am new to Flex programming. I want to implement a custom toolstrip for an app. This tool strip will include a menu bar (or a customized equivalent) to display the common menu items such as File, Edit, etc as well as a search box. It should be flexible enough to include other menu items such as bookmarks, etc in the future. I have been thinking about mx:Group, s:BorderContainer, mx:HBox, but haven't been able to choose between them. And none of them seem espcially suited to my task as they merely specify layout of other objects. Is there any component which has direct support for such functionality. I have also thought about using mx:MenuBar but I don't know if it will be flexible enough to add non-menu items like search box.
View 2 Replies
Aug 25, 2010
For my AIR based application I am trying to create a custom component based on canvas which has an image (as shown below).
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="100" cornerRadius="5" borderStyle="solid" borderThickness="2" dropShadowEnabled="true" borderColor="#EDEDE8" dropShadowColor="#dddddd" shadowDistance="5" shadowDirection="center">
[Code].....
As a work around, I am trying to add an creationComplete listener to the canvas in my custom component and used to give titleImage.source = this.path . keep changing the image or when the path of the image fetched using some async call.
View 1 Replies
Apr 16, 2011
i have created custom components in flex where i have used a button,i want to change button text when i will use that component in other mmxl file how i can do that?
View 1 Replies
Sep 18, 2011
I am pretty new to flex, specially to mxml part. There are some confusing things for me.[code]...
So question is how do I access that button's properties. I want when something happens in Xyz file, button's (someId) visibility to become false. If Abc.mxml was AS class file then it would be easy, just make object etc., but how to get if it's mxml file.
View 1 Replies
Jan 22, 2010
I have a base class which is being created via remote_object [RemoteClass alias] from the server.I have other specialized classes that are derived from this baseclass, but serialization with the server always happens with the base class.The base class has meta data that defines what the derived class is, for example
[RemoteClass (alias="com.myco...')]
public Class Base
{
[code]....
View 2 Replies
Aug 24, 2010
My application will need some windows but I can't use the popUpManager to handle custom components so I'm thinking to implement a new window system. But I still don't know how to merge it with my custom components.
[Code]....
View 1 Replies
Nov 4, 2011
I have the following situation:I have an event handler, that displays small messages in my application's statusbar.These messages get passes through by dispatching events from custom components.A simple message could be like "HTTP Error" or so.Now, the main event listener, in the main application file, listens to the event dispatched by any custom component,but seems to refuse listening to events dispatched by custom AS classes.Here is my code for the custom event:
package main.events
{
import flash.events.Event;[code]..
So to sum it all up:
- The event listener listens to the custom event dispatched by any custom component.
- The event listener does not listen to the custom event duspatched by an AS class.
Those who wonder, the event really gets dispatched, that's why I added a trace call.
View 2 Replies
Jan 25, 2010
I couldn't work it out yet...
package components {
public class templateSelection extends VBox {
static public var tempSelectionBag:Dictionary;
[Code]....
I want to have a custom class tempSelection with a Dictionary as a public accessable property of that class. If I use this code, the compiler tells me:
1046: Typ wurde nicht gefunden oder war keine Kompilierungszeit- onstante:Dictionary
Which translates to:
Type was not found or was not a compile-time constant: Dictionary
View 1 Replies
Jul 16, 2009
I'm slightly new to Flash CS3 + AS3 combo, so its more of a lack of practice question. My question stems from the problem described here http:[url].... . Note, its not the same problem, its a new one.The Problem ,So I have multiple library assets (which are on teh stage) and I want to assign similar functionality to all of them.
Attempt 1: So I create the n assets, create a custom class in AS3, link them to Flash CS3 and obviously enough it gives me the error that multiple assets can't be linked to the same class.Obvious enough to understand (well not completely, because from a programmers background it doesn't make sense).
Attempt 2: Same as attempt 1, but instead of linking all the assets to the same class I make the base class the same class, and let the derived class be dynamically created by Flash on compile time.So the linking works, but the problem is, in my base class I have a method which does something (say an tween) on a child of the library asset. So if the assets on the stage/library are called asset1, asset2, asset3 (same name for asset name, class name, id name), each of them has a sub-movieclip called ... say 'foo'. now if I manually wrote a class for each asset, I could do 'this.foo' to play with the sub-movieclip. However since this functionality is in the parent class, I'm unable to do it.
P.S. If you're form a programming/OOP background, its basically a abstract class problem. My Base class knows how to doSomething(), but it needs aSomething, which is defined in the Derived classes. However I found out that AS3 classes don't support virtual(C++ )/abstract (Java) in the true sense of the word (unless I missed some obvious documentation).
View 3 Replies
Sep 29, 2011
Let's say Class A has the flash.events.Event imported. Now let's say Class B extends Class A. Why in the hell do i need to import flash.events.Event in Class B? It makes no sens at all to me.
View 3 Replies
Jul 22, 2009
I'm trying to create a new instance of a MovieClip when the original one has been used. Would sound easy enough. Just use: var
instanceName:ClassName = new ClassName();
the class name/mc in the library im trying to duplicate is MCg1 so
var instanceName:MCg1 = new MCg1(); right?
However, the particular object in the library i'm trying to duplicate has a base class that is an external class file (just to control it's drag drop functionality)... i.e baseclass is not set to the standard flash.display.MovieClip, or whatever the case maybe. So i end out with a: TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 6 Replies
Oct 11, 2011
For example the spark ComboBox.Where is the default skin?Is it generated (at compile or runtime)?If it was in fact written by someone how does the compiler/Virtual Machine know where to find the skin class? I didn't see a location specified in the ComboBox source.
View 1 Replies
Jun 22, 2010
I have this Fla which contains a symbol that is linkaged to a certain class that is in my project. That class inherites a base class named CMovieClip which resides in one of the libraries that is in the class path (and inherites from MovieClip).Of some reason, every change that I do in the base class doesn't seem to influence the resulting linkaged class, much as if this library is cached somewhere that I can't feagure out.I tried to create the same conditions in a separate Fla but it does not repeat the issue.I tried to duplicate the symbol but the issue isn't solved that way.
View 4 Replies
Mar 1, 2011
I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.
In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip
[Code]....
I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!
View 4 Replies
Sep 20, 2009
I am creating a Weapon class for a game and the weapons itself will be the sub classes. The sub classes will hard code some values (such as max ammo and the weapon name).
I trying to access this declared data in the base class constructor, at the moment it's not outputting the values. Is this possible?
I've broken my Weapon class for simplicity:
ActionScript Code:
package
{
import flash.display.MovieClip;
[Code]....
My current workaround is creating a protected method in the base class to trace the information and calling that method in the sub class's constructor, this works fine but this doesn't seem like the most efficient technique?
View 7 Replies
Apr 12, 2009
I am having trouble using a custom event in flex. I need to dispatch an event from inside two nested components and receive it in the main application file. The basic set up is a main application file importing a custom "gallery" component.
[Code]..
View 1 Replies