The same way you dispatch any other event: Construct the Event instance, set 
its properties, and then call dispatchEvent() on the object that the event 
should be dispatched from (which generally is 'this'):

var mouseEvent:MouseEvent = new MouseEvent(MouseEvent.MOUSE_DOWN);
mouseEvent.localX = 10;
mouseEvent.localY = 10;
...
someComponent.dispatchEvent(mouseEvent);

Gordon Smith
Adeobe Flex SDK Team

From: [email protected] [mailto:[email protected]] On Behalf 
Of veena pandit
Sent: Monday, July 27, 2009 4:46 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Question about a flex component



I'll try it.  So how would I do it?
On Mon, Jul 27, 2009 at 7:25 PM, Gordon Smith 
<[email protected]<mailto:[email protected]>> wrote:


You can try dispatching MouseEvents, but I'm not sure that they'll work exactly 
the same as a Player-generated one.



Gordon Smith

Adobe Flex SDK Team



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of veena pandit
Sent: Monday, July 27, 2009 4:17 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [flexcoders] Re: Question about a flex component





It is really complex code.  I don't understand it yet.

On Mon, Jul 27, 2009 at 7:02 PM, Gordon Smith 
<[email protected]<mailto:[email protected]>> wrote:



Normally only the Player dispatches MouseEvents, in response to the user using 
the mouse. Why would you want to dispatch a MouseEvent in your code?



Gordon Smith

Adobe Flex SDK Team



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of veena_kris2003
Sent: Monday, July 27, 2009 3:44 PM

To: [email protected]<mailto:[email protected]>
Subject: [flexcoders] Re: Question about a flex component





I fixed it so that I called the change="horizontalScrollListChange(event)". 
Then I pass in a ListEvent to the horizontalScrollListChange method. Can I 
dispatch a MouseEvent
from the horizontalScrollListChange method?

--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Gordon 
Smith <gosm...@...> wrote:
>
> That's not how list-based components work. You don't add event listeners to 
> data items. You listen to events dispatched by the list itself.
>
> What are you trying to accomplish with your event handlers?
>
> Gordon Smith
> Adobe Flex SDK Team
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On 
> Behalf Of veena_kris2003
> Sent: Saturday, July 25, 2009 3:52 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Question about a flex component
>
>
>
> My message from earlier today never got posted. How do you add event 
> listeners to objects in the horizontalList. I added the event listeners to 
> the objects before I added the objects to the list. The event listener is not 
> getting called.
>
> --- In 
> [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>,
>  Gordon Smith <gosmith@> wrote:
> >
> > You add child components which are UIComponents to a container like HBox.
> >
> > But you add data items to a list-based control like HorizontalList. These 
> > data items then get displayed by item renderers, which are children which 
> > get automatically created to display data items. The children are managed 
> > by the list, not by you... you manage the data, not the renderers.
> >
> > By default, data items are expected to have a 'label' property to display, 
> > unless you set the labelField or labelFunction of the list component. They 
> > can be plain Objects, or instances of data classes, or anything else, but 
> > typically they aren't visual components.
> >
> > Here's an example of adding two data items to a list using ActionScript.
> >
> > myList.dataProvider = new ArrayCollection();
> > var item:Object;
> > item = { label: "One", data: 1 };
> > myList.dataProvider.addItem(item);
> > item = { label: "Two", data: 2 };
> > myList.dataProvider.addItem(item);
> >
> > Gordon Smith
> > Adobe Flex SDK Team
> >
> > From: 
> > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> >  
> > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>]
> >  On Behalf Of veena_kris2003
> > Sent: Friday, July 24, 2009 3:19 PM
> > To: 
> > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> > Subject: [flexcoders] Re: Question about a flex component
> >
> >
> >
> > Please help. The items are being added dynamically to the 
> > <mx:HorizontalList id="test" bottom="0" width="100%"
> > backgroundColor="0x000000" horizontalScrollPolicy="on"
> > verticalScrollPolicy="off"/> I debugged the code and the
> > items are being added, but I can't see them in the UI.
> > If I change mx:HorizontalList to mx:HBox I can see the items
> > in the UI. What am I doing wrong?
> >
> > --- In 
> > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>,
> >  Gordon Smith <gosmith@> wrote:
> > >
> > > No, I don't have an example and don't have time to create one for you 
> > > since I'm a development engineer, not a support engineer. But here is 
> > > what you should try, learning as you go:
> > >
> > > 1. Create an app with an <mx:HorizontalList>.
> > > 2. Make it show data items by assigning its dataProvider. Put in more 
> > > data items that will fit.
> > > 3. Turn off its scrollbar by setting horizontalScrollPolicy="off".
> > > 4. Create <mx:Button>s for "Previous" and "Next", positioned to the left 
> > > and right of the HorizontalList.
> > > 5. In their 'click' handlers, put code like 
> > > horizontalList.horizontalScrollPosition += 1. Use -= for the Previous 
> > > button.
> > >
> > > Gordon Smith
> > > Adobe Flex SDK Team
> > >
> > > From: 
> > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> > >  
> > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>]
> > >  On Behalf Of veena_kris2003
> > > Sent: Thursday, July 23, 2009 4:42 PM
> > > To: 
> > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> > > Subject: [flexcoders] Re: Question about a flex component
> > >
> > >
> > >
> > > Do you mind posting an example. It sounds like this is what I was looking 
> > > for. I need a horizontal list component with an icon at the right end of 
> > > the component that I can click and scroll to more items.
> > >
> > > Thanks,
> > >
> > > Veena
> > >
> > > --- In 
> > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>,
> > >  Gordon Smith <gosmith@> wrote:
> > > >
> > > > Why not just allow scrolling instead of paging? Scrolling components 
> > > > can scroll through thousands of items quickly.
> > > >
> > > > Suppose there are 100 items and you can only see 10 at a time. So first 
> > > > you see 0-9. When you click the icon you see 10-19. When you click it 
> > > > again you'd see 20-29. So you'd need another icon ("previous page" 
> > > > instead of "next page") to go back to 10-19 and then 0-9.
> > > >
> > > > Gordon Smith
> > > > Adobe Flex SDK Team
> > > >
> > > > From: 
> > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> > > >  
> > > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>]
> > > >  On Behalf Of veena pandit
> > > > Sent: Thursday, July 23, 2009 10:22 AM
> > > > To: 
> > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>><mailto:flexcoders%40yahoogroups.com<mailto:flexcoders%2540yahoogroups.com>>
> > > > Subject: [flexcoders] Question about a flex component
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I am new to Flex. I am looking for help on designing a custom component 
> > > > that will
> > > > hold a lot of items. When the items exceed the number that are visible 
> > > > in the ui
> > > > of this horizontal component on the webpage an icon appears, which if 
> > > > you click
> > > > will show a list of the other components you can click again and 
> > > > restore the ui with
> > > > that item. Hope you understand what I am talking about. If not please 
> > > > post for clarification.
> > > >
> > > > Thanks in advance,
> > > >
> > > > Veena
> > > >
> > >
> >
>




Reply via email to