Flex :: Dispatching Custom Event From Repeater Component And Listen Event In Other Repeater Components

May 4, 2011

I have a repeater component with custom event. My repeater components fires custom event holding data. My need is to dispatch event so other repeater components can access data from dispatching component.

Edit: Added whole stuff here.

<!-- AttributeMapping.mxml -->
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"

[Code].....

View 1 Replies


Similar Posts:


Flex :: Add Event Listener To Components Inside A Repeater

Oct 11, 2011

I want to add an event listener to each component inside a repeater, but don't know how. Here's some code I have tried:

<mx:Repeater id="rp" dataProvider="{dataProvider}" width="100%">
<mx:Button id="attach" creationComplete="addListeners(attach[rp.currentIndex])"/>
</mx:Repeater>

This doesn't work. creationComplete is not called until the repeater has finished instead of (as I expected) when the creation of the button is complete. I'm not sure how to accomplish this.

BTW - I also tried placing the creationComplete on the parent component to the repeater, but it would only be called the first time the component was rendered (the data inside the repeater sometimes changes) so that didn't work.

View 1 Replies

Flex :: Getting .length Of Custom Component Id Within A Repeater Works Sometimes But Not All The Time?

Jun 7, 2011

I have a repeater that populates a component, called 'project'. The project components are given an ID of 'wholeProject'. In all of my functions up until now, I was able to determine how many project components were made by doing the following:

wholeProject.length;

I used this in for loops, for each loops, and for changing the item settings within a project, i.e. something like this:

wholeProject[i].studentName = "Billy Bob";

However, I'm creating a new function that does not seem to like this wholeProject.length reference. I'm using it within the same level as all the others (i.e. the parent level). So far, my function is simply this:

public function getStudentYears():void
{
Alert.show(String(wholeProject.length));
}

when the application loads, the alert message simply does not appear. If I change the alert to something like this:

Alert.show("This is just a test.");

it works just fine. But for some reason, the wholeProject.length doesn't work in this function whereas it does in all my other ones.

View 1 Replies

ActionScript 3.0 :: Flex: Send Event Or Something To Repeater Item

Feb 13, 2010

I have a Tile with a repeater. I need to select a repeater item or the tile and change its values, or fire an event, or something.

View 1 Replies

Flex :: ViewStack With A Repeater - Repeater Gets Placed At The Bottom?

Sep 2, 2010

I have a problem when creating a ViewStack, with a repeater along with other components (i.e. vBox) inside the ViewStack. The repeaters get placed at the bottom of the view. Despite the repeater is listed before other components, it is placed at the bottom.Is there a workaround where I can get the repeater drawn before the other components?Here is an example:

<mx:ViewStack id="viewStack" width="100%" height="100%" backgroundColor="#FFFFFF"
backgroundAlpha="1" paddingLeft="5" paddingRight="5" paddingBottom="5">
<mx:Repeater id="editorsRP" dataProvider="{dynamicFields}" [code].....

View 2 Replies

Flex :: Dispatching Custom Event From A Custom Component?

Sep 8, 2011

I have a custom Flex 4.5 component (to be used in a List) -

Game.mxml (represents a clickable playing table in a card game):
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer [code].......

But I never see the "game clicked: " trace. Does anybody please know why? I'm probably missing something minor, because I can see the "Clicked: 8946" trace.

View 3 Replies

Flex :: Use Repeater For Components Inside Swc?

Nov 4, 2011

I build a swc file by Flash CS5 contains some interface component like TextInput, Label.And then I use it in a flex program.

But I meet the problem when I want use flex repeater for this component.

Following is the a component defined by myself in swc file using Flash CS.[code]...

View 1 Replies

Flex :: Components Inside A Repeater Not Resizing As Expected?

Jun 3, 2010

I have an mxml panel in which I'm using a repeater. The panel can be resized horizontally and I would like for the repeated components to resize together with panel. Here is a simplified example of how things look like:

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" ...>
<!-- scripts and some controls -->
<mx:VBox width="100%">

[code].....

View 2 Replies

Flex :: Repeater Component With Grid Layout?

Aug 3, 2009

I have a randomly-sized array of items. I'd like to display one label for each item in a Repeater component. I want them to display in a grid layout with 5 columns and as many rows as needed. How do I do that in Flex / ActionScript?

View 2 Replies

XML :: Flex 3 - Using Repeater And Sending XML Information To Component

Apr 26, 2011

I trying to import an XML file, and send bits and pieces to a custom component. My XML file is structured like this:

<projects><project>
<projName>{Insert title of project here}</projName>
<startDate>{Insert date here}</startDate>
<positions>
<daysOffset>{Insert a number here}</daysOffset>
[Code] .....

When I save the project, I do not get any errors or warnings. However, when I attempt to output the values in the component, the projectPositions piece comes back as Null.

View 1 Replies

Flex Custom Event - Dispatch An Event From Inside Two Nested Components And Receive

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

Actionscript 3 :: Flex 4 Disptaching Custom Event From Custom Component (why Flex Converting Custom Event To Mouseevent)?

Mar 2, 2012

This is NOT duplicate of my earlier post (its is slightly different)But this is similar issue with similar error but its not the same error The error I am getting now is below while dispatching the custom event from my custom component

TypeError: Error #1034: Type Coercion failed: cannot convert events::MapEvent@a74ab51 to flash.events.MouseEvent.
dispatchEvent(new MapEvent(MapEvent.CLICKED_ON_MAP));

Note: The error in my earlier post is giving below error message

Type Coercion failed: cannot convert flash.events::Event@81ecb79 to com.events.ShopEvent

The difference here are two things, the earlier error is while converting flash event to custom event and now this one is while converting custom event to flash event and secondly, I have no clue why it is trying to convert to the mouseevent where I am just dispatching my custom event with proper listeners.

This is my custome event

package events
{
import flash.events.Event;
import ui.map.MapElement;

[code]...

View 1 Replies

Flex :: Components Are Not Dispatching KeyDown Event When It's Used In PopupWrapper

Oct 27, 2011

I'm using a component in a cairngorm PopupWrapper. I want to listen to the KeyboardEvent.KEY_DOWn event on the component but it doesn't seem to be dispatching it. Is it because it's in PopupWrapper? Is there anyway I can get it to dispatch the event?[code]

View 1 Replies

Actionscript 3 :: Flex Repeater - Toggle Sibling Component Visibility On Checkbox Change

Jun 2, 2010

I have a Flex repeater that has a complex item template. When a checkbox is clicked, I need to toggle the visibility of a sibling button contained in the same repeater template. Since I can't add binding expressions to event handlers, I can't pass in the repeater item's index.

How can I access sibling components inside a repeater item?

View 1 Replies

Actionscript 3 :: Flex Custom Event Dispatching

Oct 10, 2010

I got a question about event dispatching in flex.my goal is to get a custom event loaded up with some data and than bubble up to the eventlistener. my main application has and AMF service request inside which calls an service class. that class is supposed to dispatch an event when the AMF service request returns a result or fault and the main application is listening for that event.so inside my mainapp i add and listener like this:[code]
However, this event never reaches the main application. Looking closely to it with the debugger, i found out that when the event is dispatched the listeners property of it is set to null.

View 5 Replies

Flex :: Dispatching Custom Event From ItemRenderer?

Feb 15, 2012

I'm trying to dispatch a custom event from a custom ItemRenderer. This is my custom event
package events {
import customClass.Product;
import flash.events.Event;
public class CopyProductEvent extends Event {
public static const COPY_PRODUCT:String = "COPY_PRODUCT";
public var picked:Prodotti;
[Code] .....
The event from the function is dispatched correctly... I can't intercept it..

View 1 Replies

ActionScript 3.0 :: Dispatching An Event In The Child And Listen For In The Parent?

Oct 6, 2009

I have a dialogBox with 2 buttons - ok_btn and cancel_btn. The code is in a Class - testDialog.

There are 2 issues:When any of the 2 buttons clicked, they dismiss the dialogBox without sending any alert to the parent (main time-line).How to trap the clicked buttonId in the parent.I have just an idea of the solution as dispatching an event in the child and listen for that event in the parent. But, unfortunately, I don't know how to go about it.

To make my point clear, here is the code:

Code:

package
{
import flash.display.*;
import flash.events.*;

[Code].....

View 6 Replies

Flex :: Propagating Event From A Built-in Component To A Custom Event?

Jan 27, 2012

I am trying to understand event propagation in Flex framework and have a following doubt on it:

Scenario: I have a built-in component DropDownList on change of which I want to create a custom event refreshPreview and want to propagate it to a custom component PictureComponent.

In the custom component's mxml, I have added the Metadata directive as follows to register a refreshPreview event with the compiler

<fx:Metadata>
[Event(name="refreshPreview", type="flash.events.Event")]
</fx:Metadata>

Layout Details: In my main mxml application I have laid out DropDownList and the custom component such that both are siblings (i.e. have a common indirect parent)
e.g.

<s:Group id="contentGroup">
<s:Group id="formGroup">
<s:Form x="11"

[Code]....

I am seeing that the refreshPreview event is not getting propagated to the custom component.

I doubt this is because the built-in component is a sibling of the target (where the event got generated) and not a parent. how to make refreshPreview event propagate to custom component?

View 1 Replies

Flex :: Listen To A Custom Event Dispatched By A Renderer?

May 2, 2011

I'm having the following problem: I've implemented a custom headRenderer for my DataGridColumn. The idea is to have a dropdown menu when clicked on the column header. The problem is I don't know how to add a listener or pass a variable to the renderer since the renderer class is instantiated by the ClassFactory.

The renderer class:

<?xml version="1.0"?>
<!-- itemRenderersdataGridmyComponentsRendererDGHeader.mxml -->
<mx:HBox xmlns:mx="library://ns.adobe.com/flex/mx"

[Code].....

View 1 Replies

Flex :: Dispatching Event From AdvancedDatagrid To Its Item Renderer Component?

Mar 4, 2011

I Need to catch an event in itemrenderer component dispatched from its parent i.e an advanced datagrid. How could i achieve it

View 2 Replies

Change Child Component In Another In A Repeater?

Nov 10, 2010

I have a custom component in a repeater. This component has a child component which can be of two types depending on some conditions. [coed]...

When I place breakpoints in the functions called at creationComplete, I can see that the component assigned to placeHolder is correct but it does not show on my display. I tried refreshing by calling invalidateDisplayList in every place I can think of but it does not seem to work.

View 1 Replies

Actionscript 3 - Flex :: Click - Outside Event On Custom Components

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

Flex :: Disptaching Custom Event From Custom Component?

Feb 16, 2012

This is similar to the question asked here. I am dispatching custom event "ShopEvent" but i am getting error "Type Coercion failed: cannot convert flash.events::Event@81ecb79 to com.events.ShopEvent"Note: Error is thrown from the parent custom component (3rd code snippet), I have added more details thereThis is my custom event. See the first constant, I copy pasted the event name in custom components.

package com.events
{
import flash.events.Event;

[code]......

View 3 Replies

ActionScript 3.0 :: Dispatching A Custom Event From Parent Swf To Child Swf

May 8, 2010

I'm building an all flash site, where one .swf acts as the parent, and other external child .swf's are loaded in using .xml. The "Child.swf's" are a mixture of timeline animations, and coded swf's, and the problem I'm having is that they immediately start playing as soon as they are loaded. I've not been able to find any straightforward "child.start() or child.stop()" solutions, so I assume it's more involved than that.

I thought it might be a good idea if I could dispatch events from the parent swf that will set them going. I'm using the sharedEvents method to communicate in the reverse direction (child to parent), but I don't believe it can be used from parent to child (Please correct me if I'm wrong!) I know I could go to each child and put "stop();" in the first frame, but how do I start it again? I would also prefer it if not all the child .swf's started immediately, but to wait until others have completed their routines. Again the way I see it is to dispatch an event from the parent .swf as soon as I'm ready to set them going.

View 6 Replies

ActionScript 3.0 :: Proper Syntax When Dispatching A Custom Event

Jul 7, 2009

i have a class where I'm setting a simple custom event name as a static const such as:

Code:
public static const ON_OVER:String = "HotSpot_ON_OVER";

When an instance is created in parent container object, I'm simply using:

Code:
theInstance.addEventListener(HotSpot.ON_OVER, hsOverHandler);

Within the HotSpot class, when I dispatch that event - both of the following work, but is one preferred or more proper than the other?

Code:
dispatchEvent(new Event(HotSpot.ON_OVER));
//or
dispatchEvent(new Event(ON_OVER));

View 1 Replies

ActionScript 3.0 :: Listen To A Custom Event In Various Classes At Same?

Jul 17, 2011

I'm using a electronic device to dispatch events within AS3.
 
short explanation: -->

Think of these events as a KeyboardEvent.My point is to dispatch an Event (like a Key that is being pressed) so I can listen to this event on EVERY Class I need to.I'm not sure how to instantiate or listen to these events correctly =/
 
I mean: I want to be able to listen to the key that is been pressed as if that was a global event every Class can receive...
 
long explanation: --> I'm doing something like this:

1) created a (main) Class that extends a Sprite.

2) created a class (KeyboardInput) that extends the main class.

3) created a class (KeyMap) that extends EventDispatcher.

4) created a class (HomeScreen) that extends a Sprite.
 
 My FLA file is associated to the KeyboardInput Class.This Class creates a listener for the KEY_DOWN KeyboardEvent and instantiate the KeyMap Class that dispatches a CustomEvent:
 
stage.addEventListener(KeyboardEvent.KEY_DOWN,function(evt:KeyboardEve nt):void { keymap = new KeyMap(); keymap.setKey(String.fromCharCode(e.charCode)) });[code].....

View 3 Replies

Flash :: Using A Custom Event To Listen For Collisions?

Feb 13, 2012

I'm new to flash and programming in general but am learning it to make games. I'm currently messing around with hit detection and its not to hard to test in the game tick ( fired from onEnterFrame). What I'm wondering is if it would be possible / useful to create a custom event that i can listen for. And make the eventListener hear when a collision happens. Also would this be better or worse for the cpu than testing the collisions of lots of enemies on a screen?

View 2 Replies

Flex :: Event In A Custom Component?

Sep 11, 2010

I'm just getting started with custom events in a custom component. And I don't quite have the hang of it, yet. I've got a component with a button in it. When it's clicked, I want to call a function in the main app.

Custom Component:
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" >

[code].....

View 1 Replies

Flex :: Event Flows For Built-in Event And Custom Event

Aug 22, 2011

I hava a custom component and it contains a child icon. If I add a mouse-click event listener to both component(click-listener1) and icon(click-listener2), the event dispatched sequence is click-listener2, then click-listener1. I can understand it. But if I add a custom event to component (listener1), and mouse-click event to icon(listener2), when icon is clicked, the component will dispatch the custom event. In my test, the event dispatched sequence is listener1, then listener2. It doesn't match with event-bubbles rule.

In my opinion The custom event is dispatched in listener2, which triggers listener1. Why event flow sequence is not listener2, listener1?

In component.

icon.addEventListener(MouseEvent.CLICK, iconClickHandler);
private function iconClickHandler(event:MouseEvent):void
{

[Code].....

View 1 Replies

ActionScript 3.0 :: Wrap Head Around Dispatching A Custom Event But Listening For It In Another Class

Mar 3, 2012

So I am able to dispatch the event from one class and trace out that the custom event was dispatched, but where I am having trouble is listening for that event in another class.

[Code]...

View 14 Replies







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