Actionscript 3 :: Refer To A Spark View Component In Code?

Nov 12, 2011

I'm building a mobile AIR app using Flash Builder 4.5. The initial view in my views package is TestHomeView.mxml. I want to refer to it in one of my .as classes elsewhere in the app, and I'm not sure how to do that.

Theoretically I should be able to add an "id" attribute to TestHomeView.mxml, but FB gives me an error: "id is not allowed on the root tag of a component". The root tag is s:view.

The reason I need to do this is that within another class I make various calculations and then need to pass an array of values to a component in my view class. So in SomeOtherActionScriptClass.as I first assemble the array, myArray, and then in that class I want to do this:

myViewComponent.viewArray = myArray;

If I'm going to do that, I also need to import the view class into the .as class, which strikes me as weird. So is there a simple way to do what I want, or do I have to dispatch a custom event which contains the array, and listen for it in the view class?

EDIT - Based on the below MVC suggestion I did the following in model:

[Bindable]
public class Model
{
private static var myModel:Model;//doesn't let me name it 'model' because

[code].....

But it is coming back null. It isn't null when I put a breakpoint in the Model class, but when I try to access it from the view class, it's null. The model itself isn't null, but that variable is.

View 2 Replies


Similar Posts:


Flex :: Hero Spark Component - Changing View From Within Custom Itemrenderer?

Mar 22, 2011

I've made a custom list itemRenderer with 2 buttons and a label. One button deletes the list entry (and thats not the problem) the second button would change the actual view.how I can change actual view within the itemrenderer ?

View 1 Replies

ActionScript 3.0 :: Spark Scroller, Switch Focus To Spark View But It Still Scrolls

Jan 26, 2012

I am working on a drag and drop feature for the sparkScroller. This is sort of how my layout looks:
 
<mx:Canvas>
<s:Scroller id="items" .. />
<mx:Box id="dummyRow" visible="false" />
<s:View id="touchView" visible="false" />
</mx:Canvas>
 
So when you hold your finger over a row in the items Scroller for more than a 30 seconds, the touchView becomes visible so does the dummyRow. The dummyRow gets populated to look like the row which you held your finger over.
 
So the touchView has the event handlers for moving your fingers and places the dummyRow where your finger is. The problem I am having is even though the touchView is reacting to my move events, the scroller still keeps reacting to my move events as well even though it's a sub layer. Because I started on the scroller it still keeps track!
 
How can I remove focus / tracking from the scroller?

View 1 Replies

Flex :: 4 - Add Component To Title Bar Of Spark Panel Or Spark TitleWindow

Feb 7, 2011

I'm looking to add a couple of buttons to the title bar of a Spark Panel or Spark TitleWindow. Is this possible to do without making the panel from scratch?

View 1 Replies

Flex :: Make A Custom Component Or Extend The List Component For A 2D Top Down View MAP ?

Nov 11, 2010

I'm building a top view 2D map, that it's objects are stored on the server.The kind of objects are 10 and might be a photo, label, button, lists, mix of them or labels with tooltips.The component must request the "areas" that are missing on screen.An area is 1000x1000 px and is cached in flex.To move in the map, will be like in google maps (drag-and-drop).I should be able to have another list and move objects from one to another using drag-an-drop on objects. Ex.: I grab an objects from a list and I move it on this map, I release the mouse button and the item is placed there.Now the problem is: I build a custom component for this trying to emulate the item renderer for performance and recyclage, implement drag-and-drop on objects and request the areas that are missing?

or

I extend the List component from spark and I add some features as multiple kind of itemrenderers and use recycle on them. Of course it must be able to request the missing areas on the screen and cache it's data.Maybe create a custom layout is needed too.What I need is something that must be really fluid, so the lighter this component is, the better.

UPDATE: *There will be not any object over another.

*I will not use hitTest on bitmaps because all bitmaps are wrapped in another component,as they,for now are itemrenderers.

Anyway I already begin to do this using a class that extends the SkinnableDataContainer and a custom layout. As the layout is not like a grid, is sparse, random items at diferent points(x, y).How to get the localX and localY, relative to item renderer and not to the Spark List, from a DragEvent in Flex 4?

View 1 Replies

Actionscript 3 :: Updating View Spark.components.List?

Sep 23, 2010

I am using a List component inside an itemRenderer. The main user interaction involves dragging an item from the List in one renderer and dropping it in another. My problem: When the data object is updated I want the Lists' height to be modified according to the number of objects in the dataprovider(dp), which is passed to the List from the data object. Now I have tried to invalidate the display of the List, refresh its dp and have tried putting this line assets.length > 0 ? assetList.percentHeight = 100 : assetList.height = 10; in other event handlers, such as dragdrop handlers, collection event handlers for the dp etc. I have also tried refreshing the dp for the List component that is using this renderer. The view does eventually get updated but only if I resize the list, or use the scroller or when I begin dragging a new List item but never after the drop.

[Code]...

View 1 Replies

Actionscript 3 :: Flex Spark View-port Scrolling?

Sep 8, 2011

I face a problem while i am try to scroll up or down the content in a scroller via viewport. my MXML cod is

[Code]...

View 2 Replies

Flash :: Getting Mouse Events From UIComponent Child In A Spark View Does Not Work

Nov 3, 2011

I have a custom UIComponent that is basically just this:

public class WhiteboardUIComponent extends UIComponent
{
public function WhiteboardUIComponent() {
super();

[Code]....

This is absolutely the simplest that I could make the example. The s:View is gobbling up my mouse events - if I add a handler in the MXML to the View, I get mouse events just fine. When adding a handler programmatically in my subclass' constructor, I get nothing. I thought maybe the layout was wrong, so I explicitly set the dimensions of my UIComponent and stuck it in a border just to be sure it was where it was supposed to be - same deal.

View 1 Replies

ActionScript 3.0 :: Refer To A Class Linkage Set In Library From External Code?

Jan 12, 2011

If one uses [Embed] to refer to external graphic assets its easy to instantiate and use them.However, I've got a png in an Fla, with the Class identifier set to "Symbols", Base class is BitmapData.I need to instantiate it like this:

var symbols:BitmapData = new Symbols(1, 1);
addChild(new Bitmap(symbols));
 
Of course the compiler complains about a call to a possibly undefined method Symbols.For a temporary fix I guess i'll put the graphic external to the swf, but for this project it needs to be in the library along with everything else.

View 9 Replies

Actionscript 3 :: Refer To An Instance From Inside It's Own Code In Adobe Flash?

May 16, 2010

In Adobe Flash, I have a movie clip that is added to the stage when the keyboard is pressed. I want it to travel across the screen and disappear once it reaches the edge of the stage. At the moment I use this but the image appears and then stops. Here is my code:

addEventListener(Event.ADDED_TO_STAGE,runtime);
var c = 0
function runtime(){

[code]....

View 2 Replies

Flex :: Shrink The Default Spark DataGrid Row Height And Keep The Text Vertically In View?

Dec 11, 2011

In the Spark DataGrid the default row height is about 22 px. I would like to set the default row height to 18 pixels and I can do this easily enough with the rowHeight property but what happens is when the rowHeight is set to anything less than 22 px the bottom area of the text in each row is cut off. It seems that the default grid itemrenderer or grid label has a min height set to it. Since I have multiple columns and want to have shorter rows but not have the bottom of the text cut off in each row how would I do this?

View 2 Replies

CS4 :: View Code In Flash?

Aug 2, 2010

How do I view code in Flash CS4? I am wondering if it's even possible but I am new to Flash so I guess anything is possible, haha. I need to fix my actionscript and this is one of the ways I was told to do it was to look at the code first.

View 2 Replies

View All Executed Code In FLA File

Jun 20, 2011

I wonder if there is any way to view the Actionscript that is exectued when executing a fla file. Or maybe a tool that would allow me to generate Actionscript through a graphical interface.For example, I create a Flash File and draw a circle.

View 1 Replies

View All Code In The Document And Where It Is Stored?

Jul 24, 2009

I inherited a flash file.It uses arrow keys to advance from scene to scene, so I know there is probably some key listener code somewhere. But I can't find the code! Is there a way to view all code in the document and where it is stored? Or is there a document level area for code that I'm not seeing? I just started using CS4 and I'm not sure of all the new features.

View 6 Replies

ActionScript 3.0 :: Possible To View Code Of SWF File?

Jun 18, 2009

Is there a way or a tool to get the AS code of a page's swf-file?

View 1 Replies

ActionScript 3.0 :: Building A Spark Component?

May 13, 2010

I'm making a spark component and I've defined my own skinpart which doesn't show up in Flash Builder's design view. When I run the app it works fine. I'm basically using Panel and PanelSkin as a guide. For debug purposes... I just took the panelskin and renamed the controlbar to headerI'm posting code below... but this forum kinda killed all my code formatting

Console.as
package
{

[code]......

View 3 Replies

Get MaxHorizontalScrollPosition In Spark List Component?

May 9, 2011

I want to get maxHorizontalScrollPosition for Spark list control.is any alternative propperty for it in flex 4

View 1 Replies

Flex :: Skinning Spark List Component?

Aug 2, 2010

How to skin spark List component so that every adjacent itemRenderer has different color (something like mx DataGrid)?

View 1 Replies

Flex 4 :: Way To Disable A Tab Of A Spark Tabbar Component

Dec 27, 2010

is there a common way to disable a tab of a spark tabbar component in flex 4? with the mx tabnavigator component you can just disable the content corresponding to the tab and the tab is also disabled then. but doing this with the spark tab bar component disables just the content not the tab.[code]

View 3 Replies

Flex :: Halo Theme On A Spark Component

Aug 2, 2011

I have a Flex form made up mostly of MX components. Due to limitations with the MX mx.controls.ComboBox, I'd like to use the Spark control, spark. components.ComboBox. This works, except the Spark ComboBox sticks out visually because it doesn't use the Halo theme.Is there a way to have the Spark ComboBox use the Halo theme?

View 1 Replies

Actionscript 3 :: Style A Spark Component With An Image?

Dec 3, 2011

I'm trying to use an image (embedded) for the thumb on my Spark slider component. This should be straightforward -- I know what to do in mx -- but I haven't been able to find what the Spark syntax is.

I don't even need states (up, down, over, etc) since this is going on a mobile app.

View 1 Replies

Actionscript 3 :: Creating An API For A View Component In PureMVC?

May 8, 2010

In the context of AS3 and specifically a framework such as PureMVC, what an API for a View Component means.

View 2 Replies

Actionscript 3 :: Recursive Flex View Component?

Sep 15, 2011

I have a Flex component that is a view of a data Object that recursively has a reference to itself.

For example if you had an Employee class that references a boss field of type Person, I'd like to nest the same view for that Boss. This shouldn't be an infinite recursive relationship (e.g. I'd only be viewing the boss field of each object).

I've tried creating an MXML component that references itself but when I run it locks up (seems like it gets into a recursive loop).

Is there anything you can do like includeInLayout conditions that will make sure it doesn't even instantiate that component.

View 3 Replies

IDE :: FLV Player Component - Click To View Fullscreen?

Jan 14, 2009

So I'm building a flash presentation and one slide has video. I have a flv component on the stage and the user wants the video to initially appear at a smaller size and then to click on it to launch the movie in fullscreen and to play. The playing is no problem but it doesn't want to launch fullscreen.Code below:

// VIDEO
moviePlayer_mc.fullScreenTakeOver = false;
moviePlayer_mc.addEventListener(MouseEvent.CLICK, launchFullScreen);

[code].....

View 9 Replies

ActionScript 3.0 :: View Dynamically Created Code In Flash CS3?

Mar 8, 2009

Is there a way to view the AS 3 code that Flash CS3 is creating? To be a little bit clearer about what I'm asking let me make the parallel with Dreamweaver. If you need to create an HTML table in Dreamweaver you can click the table icon at the top, configure your table, and then you can see in the code window the <table width= height=..> <tr> etc. that has been created dynamically by the software.I know its not a straight forward feature built into Flash or I would have found it but I was wondering if there is some surreptitious way of extracting the code.

View 1 Replies

Flex :: Add A Spark Component To A Mx Extended Custom Itemrenderer?

Nov 14, 2010

have been working on an air app for quite some time and in one of my mx:lists i have a custom renderer written in pure AS (no mxml). it extends the listitemrenderer mx componenet. in it i have overrode the createChildren() function to add some children of my own.

now, fort right-to-left text i want in this itemrenderer, i would like to add a spark:TextArea component in this createChildren() function

is there a way to do so?

this is the itemRenderer:
import flash.text.TextField;
import mx.controls.listClasses.ListItemRenderer;

[Code].....

View 2 Replies

Flex :: Conditional Coloring On Spark RichText Component?

Jan 26, 2011

I have a spark RichText that I want to change his color according with the value on text property.

Negative values get red, positives blue...

When I declare the component, I call a method to set up the css style, but when the value changes, the color is not updated.

How can I put a conditional CSS Style? Is possible to create custom skins to RichText component?

View 3 Replies

Flex :: Flexbuilder Spark Component Implementation Error

May 27, 2011

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.

View 1 Replies

Flex :: 4 Spark Component Panel - Hide Title Bar

Aug 18, 2011

Flex 4 Spark component Panel - Hide Title Bar I have used Spark panel to display the object inside a container. The panel and the inside elements are created dynamically. (using ActionScript). I need to remove the title bar of the panel in actionscript. When i tried to remove that, i am unable to hide the same. Tried below ways.

[Code]...

View 2 Replies

Flex :: Skin A (single) Spark Component To Look Like An MX Components

Oct 12, 2011

I want to use a Spark ComboBox with numerous MX Components but the Spark ComboBox does not look the same as the MX Components. Is there a skin I can use to Skin Spark components like MX components?

[Code]...

View 1 Replies







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