Actionscript 3 :: Make Flex Entry-point MXML Subclass A Custom Class?

Oct 21, 2010

With MXML components, I've seen a pattern used where you have an AS3 class, then the MXML subclasses it, to have a separation between view/code (anonymized from real code):

package com.john
{
public class MyComponent extends Canvas
{

[code]...

At least I think the MXML component is subclassing the AS3 class?Anyway is it possible/advised to do this with my main MXML application file, so I can put manager instances and things in the AS3 MyApp class, which is subclassed by Main.MXML?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Flex Project With A Class As Entry Point?

Jul 22, 2009

is it possible to create an actionscript project (File > New > Actionscript Project) and still use mxml for the ui layout? basically, i want a main class as the entry point which can reference the controls within the mxml.i tried it the other way around (File > New > Flex Project), but it creates an mxml app that seems to serve as the entry point. if i create a class in this project, how do i make it the main entry point?//when i create this class inside a flex project, the constructor never gets called

Code:
package
{

[code].....

View 3 Replies

Actionscript 3 :: Access Entry Point Class Object From Other Classes Of The App?

Jul 26, 2011

Just wonder if I can reference entry point object from any place in the app? Is it maybe assigned to some global object, like stage is for example? Currently I use static methods and variables, but this breaks encapsulation.

View 2 Replies

Flex :: MXML Syntax To Assign Properties Of Subcomponents In Custom MXML Components?

Jun 4, 2011

I am working on a custom Flex 4 component which is an aggregation of two existing flex components. I would like to be able to specify my own custom properties for the component as well as access the existing public subcomponent properties via MXML. For instance I might want to adjust the font color or style for the label and text input. toy component which aggregates both a label and a text input:

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"

[code]....

View 1 Replies

Actionscript :: Use A Custom MovieClip Subclass As Base Class?

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

Flex :: Extending MXML Custom Components Via MXML?

Feb 3, 2011

What I'd like to do: create an MXML component with some children, then extend it via MXML to create a new component with more children, without losing the original set.In other words

create a component bc.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"

[code].....

View 1 Replies

Flex :: InvalidateList() Not Working For AdvancedDataGrid When Fired By Custom Subclass

Nov 2, 2010

I want to persist the AdvancedDataGrid column order for the user if they move them around and close the window or log out. I have code (see below) that works when I place the code in a grid parent container - eg, a title window. I'd like to generalise the functionality by placing the code in an AdvancedDatagrid subclass rather than each grid container so that all my grids have access to a single location when saving/loading their choices. My approach is to store the datafield names and grid name in an array and save/read to/from the shared object. and update the column order based on that order. The invaldation fails when I use the code in the Advanced Datagrid subclass but works fine in the grid parent.

private function loadSettings(name:String = "custom"):void
{
var gridName:String = this.stripUIDNumbers(this.uid);
var temp:Array = new Array;

[Code].....

View 1 Replies

ActionScript 3.0 :: Custom Class Setting Properties Through MXML

Mar 10, 2009

I have just created a custom AS3 Component to use in an MXML project.[code]but then i lose some re usability.What do i need to do to be able to set properties from mxml?

View 3 Replies

ActionScript 2.0 :: Random Entry Point For A Gallery?

Oct 1, 2011

Atm the home page loads up a swf gallery that literally just displays a photo then fades in/out onto the next photo etc

it always loads the first frame obviously but i was wondering if there was a way to randomly jump to another part of the timeline each time the home page was reloaded?? its not essential but would be a nice touch

View 3 Replies

Flex :: Creating Custom MXML Components?

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

ActionScript 3 :: Custom MXML Container In Flex 4

Jul 22, 2010

I want to make a custom container, usable in MXML like:
<local:MyContainer>
<s:Label/>
<s:Button/>
...
</local:MyContainer>

But I'd like to be able to catch when the children are added so that I can control stuff like when & where they're added. I tried overriding addChild(), addChildAt(), addElement(), addElementAt(), (extending the Group class) but they only fire when you add elements specifically with those functions - the application launches and the label, button, etc, end up in MyContainer without calling these functions. How do I control the addition of sub-components via MXML?

View 2 Replies

Flex :: Use A Base For A Custom MXML Component?

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

Actionscript 3 :: Three Way Binding In MXML Custom Component (using Only Mxml)

Jun 22, 2011

I'm trying to do this using only mxml, no <script> tags, although I don't necessarily need a solution that's only mxml. It was more of an educational exercise to see if I could do it all in mxml. I have a custom component that has a slider and textinput and their value/text properties are bound together. I'm surfacing a few properties of the slider in my component so that it can sort of be treated like a slider.

[Code]...

View 1 Replies

Flex :: Mxml - Converting A Custom Component To A Module?

Sep 25, 2009

How to take an existing custom component in Flex and convert it into a module? EDIT: What should be done in the mxml where this custom component is used? Should it be replaced with a to load the module? If yes, how to deal with code that uses instances of the components?

View 2 Replies

Flex :: Put MXML Child Nodes Within A Custom 4 Component?

Nov 27, 2010

Here is an example of a custom component. It is just a box with a title label and a close image (X):

[Code]...

When using the component in an MXML document, I would like to have the "(HEADING TEXT)" replaced with a parameter (should be easy) as well as the "(INSTANCE MXML)" with several labels, text inputs, check boxes, etc. (maybe harder). I have found this script-based method, but I would like a cleaner compile-time solution if one exists.

View 2 Replies

Flex :: Setting Up Content Children For Custom Mxml Component

Dec 9, 2009

I am trying to develop a custom component to act as a divider.

[Code]....

I would like to use this component to assign objects like this:

[Code]...

Unfortunately, this does not work. I get a compiler error saying: In initializer for 'left': multiple initializer values for target type mx.containers.Canvas.

View 1 Replies

Flex :: Error On Simple Custom Event When Implemented But Not In MXML?

Oct 5, 2010

I'm trying to learn how to use custom events in Flex. I'm following Oliver Merk's tutorial found here: blog

The custom event works if I implement it using MXML in the main app. But, if I use actionscript, then I get error 1119: Access of possibly undefined property ADD_PRODUCT through a reference with static type Class.

My Event:In the events subdirectory, I've got:

[Code]...

View 1 Replies

Flex :: Create Simple Custom Component With Two Labels With This MXML?

Oct 7, 2010

I'm trying to create simple custom component with two labels with this MXML:

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="250" height="30">
<mx:String id="result" />
<mx:Label x="5" y="7" id="titleLabel" text="{label}" width="120"/>
<mx:Label x="125" y="7" id="resultLabel" text="{result}" width="120" textAlign="right" color="#A41D00"/>
</mx:Canvas>

It is working well at runtime, bud I have troubles making it working at design-time. How can I make databinding work at the design time? If it is impossible, how should I code the label text assignments?

View 2 Replies

Actionscript 3 :: Flex: Refreshing Custom Mxml Component On Button Click

Mar 3, 2010

I have defined small MXML component which calls web service which returns random number on request, then my component displays the number.

How do I refresh the MXML from main application control, so it will recall server again?

View 1 Replies

Flex :: Adding MouseOver/mouseDown/mouseUp/etc. To Custom MXML Component?

Aug 21, 2011

I'm new to Flex and am porting a pure Flash/AS3 app to Flex 4.5. I've created a custom MXML component based on BorderContainer

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer
xmlns:fx="http://ns.adobe.com/mxml/2009" [code]...........

and it would work well, but here in Flex 4.5 I don't know how to do this.Also I've noticed that there is a dropShadowVisible="true" attribute, but not sure if/how it can be used for my purposes.And I'm not sure if scaling up/down a custom component is allowed in flex or I probably should use "Flex Effects" (but how?) and also set disableLayout="true"?

View 1 Replies

Actionscript 3 :: Prevent MXML Custom Component In Flex Library Project Always In Default Package??

Mar 31, 2010

I'm creating some custom components and backing code. I've created a Flex library project in Flash Builder which compiles to a SWC. The problem is now that all my MXML files get compiled into classes in the default package, making the whole thing a big mess.Is there a way to set a package declaration for MXML files? After all it just gets translated into AS3 classes. This seems to work in regular Flex projects using a namespace declaration so I'm at a loss how that is supposed to work. The other option is building out all the components in AS3 which I'd like to avoid.

View 1 Replies

Actionscript 3 :: Flex 4.5 Not Listening To Custom Event Dispatched In Custom Class?

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

Css :: Add Custom Style Property To MXML Custom Component?

Jun 22, 2011

I have a Custom Component that has a couple of Canvas with some background colors assigned to them. Now i have hard coded the colors, i want to move them to an external css file. So i would like to have the css declaration like this :

[Code]...

My question is if i can define custom style names like dividerRightColor and if so, how can i use that value inside my MXML Component? I have seen examples of using them inside Pure AS components.

View 2 Replies

Flex :: Usese AS3 Class In MXML?

Jun 10, 2010

How would I use the following AS3 class within MXML?[code]...

View 2 Replies

Flex :: Accessing A Class Within Mxml Tag?

Jul 24, 2010

I would like to provide my own sortItemRenderer within an AdvancedDataGrid like so:

<mx:AdvancedDataGrid sortItemRenderer="MyRenderer"></mx:AdvancedDataGrid>

MyRenderer is a class that I wrote, but Flex doesn't see it and gives "defintion not found" error, because it is not within the mx namespace. What is a clean way to make this to work?

View 1 Replies

ActionScript 3.0 :: Overwrite The Current Entry With A New Entry To Update The Score?

Feb 4, 2011

I have a database all set up and working between flash and SQL .The set up allows me to add entries and receive data.. all this works great..The only problem I'm having is that when I want to update the score when clicking on a button..I can only send or receive data, and what I actually want to do is overwrite the current entry with a new entry to update the score..

View 3 Replies

Flex :: Access A Custom Property In A Custom Class?

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

Actionscript :: Call A MXML Class In Flex 3

Aug 14, 2009

I have a page made of custom components. In that page I have a button. If I click the button I have to call another page (page.mxml consisting of custom components). Then click event handler is written in Action-script, in a separate file. How to make a object of an MXML class, in ActionScript? How to display the object (i.e. the page)?

[Code]....

View 4 Replies

Flex :: MXML Class Referencing Syntax?

Mar 17, 2011

I'm having a problem that has been really getting to me for the last 12 hours or so and I can't seem to find the answer anywhere. I know it's something simple, but I just don't know the correct syntax.

I've got a Flex Application in Flash Builder 4 with a file called "Test.mxml" which looks like this (simplified):

[Code]...

View 1 Replies

ActionScript :: Flex - Calling MXML Inside The Class?

Jul 27, 2009

How can i call MXML components inside my ActionScript Class.

// filename.mxml
<mx:Canvas x="181" y="180" width="333">
<mx:Button styleName="LoginButton" id="loginButton" click="checkLogin();" x="160" y="261"/>
<mx:TextInput styleName="loginTextInput" id="username" x="160" y="161"/>

[code]....

I need to access the username and password fields of MXML in my ActionScript Class.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved