Flex :: Write Events For A Custom Component In It?
Jan 4, 2010
I have written a custom component for drawing a circle in Flex. But When I try to write a click event or mouseDown event for that component, it doesn't work.[code]...
The "Hello" Alert is displayed only at a particular point and guess is, at the point, (175,150) the x, y co-ordinates of the circle. But shouldn't it be displayed wherever I click on the MyCircle component?? how to enable it in that way?
Also the mouseDown function doesn't work for MyCircle,but if have the event for the VBox, the Alerts are displayed.
View 2 Replies
Similar Posts:
Jun 24, 2011
I'm taking my first stab at writing a custom flex 4 component by extending the UIComponent class. Unfortunately, I cannot get the component to respond to any sort of mouse events.I've tried setting mouseEnabled to true is the component, as well as setting mouseChildren to true in the parent (the stage object). It seems whatever I do, my click events can be detected from the stage, but not with the component.Here is my component class:
package components {
import mx.core.UIComponent;
public class DrawCanvas extends UIComponent {
[code]......
View 1 Replies
Aug 25, 2010
LinkeSetFx has its own CollectionEvent, but I don't know how to map the LinkedSetFx event to mx.events.collectionEvent(I want use it in ComboBox). LinkedSetFx is in AS3Commons-collection framework.Here is the url, choose the as3commons-collections-1.0.0.zip, you'll find LinkedSetFx in srcorgas3commonscollectionsfx
View 1 Replies
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
Dec 11, 2010
In the main file, I would write[code]...
But if I want the component to have that behaviour innately, where do I write it in the mybutton mxml file to have it reference itself?[code]...
View 2 Replies
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
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
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
May 12, 2010
The spark panel component for example can be written like this
<Panel title="Skinny">
<child components ... />
<controlBarGroup>
<child control bar components ... />
</controlBarGroup>
[Code]...
The motivation here is that I can now create a couple different skin files to change the look and layout of those subgroups. Reading source of the spark panel, there are some calls within the mx_internal namespace such as getMXMLContent() which is a method of the spark group component, but which I have no access to.
Does the description above make sense? How can I create custom 'contentGroups' in my custom Flex4 component that can use nested mxml child components? Should I approach this a different way?
View 2 Replies
Sep 6, 2011
I created a custom MXML component, TurboContent, that extends the NavigatorContent class:
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
[Code].....
In this case, the 'myButton' component never shows up, but all the elements of the base component do (3 buttons and a datagrid).
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
Aug 2, 2011
Basically I am trying to create a string Validator which requests a new language from its controller by dispatching an event upon its creation.
The example below is a straight copy from the Flex3 component explorer - the only diffrence being that I have created the validator as a custom component which dispatches an event upon its creation.
The problem is that my main Application cannot hear the event being dispatched and I don't know why.
Here is the example
MyValidator.as
package components
{
import flash.events.Event;
[Code]...
View 1 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
Jan 2, 2010
I have an <mx:Application> which contains a <mx:Module>. This module has several child modules. It also has some an instance of a class I have created. I am trying to have a method of this class dispatch an event that can be "heard" by the module and handled. This isn't happening.To be more clear, I am using 'dispatchEvent' to from inside a class method.There is an instance of this class in: mx.core.Application.myapplication.mymodule.myclassIt is the 'myclass.somefunction' that dispatches the event. I have a listener registered in 'mymodule'. Nothing happens when the function/method runs, however.
View 1 Replies
Jul 24, 2011
bubble events up a class tree for none-ui components.I have a structure like this:Controller Unit of Work Child Unit 1 (Raise Event)I would like to handle the event raised in Child Unit 1 in the Controller. I've tried to set the bubble property to true but I've read that this only works for UI components.Is there a way to enable this for custom classes that are not UI components?
View 1 Replies
Jul 4, 2010
I have to create a custom header for the AdvancedDataGrid component. The custom header must have two buttons in it. The custom renderer must be applied to more than one column.
How I can fire, dispatch and handle events from the custom headers?
View 1 Replies
Jan 21, 2010
I created a flex component that hosts several built in (mx) components such as a listbox and combo box. My component relies on external data, and I need to expose events such as ComboBox.enter and List.click to get certain pieces of data.I was wondering if there is any easy way to do this without having to create my own custom event handlers. I'm simply trying to expose these events with different names so that when my component is used, I can do things such as:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:com="com.*">
[code]........
View 4 Replies
Jul 19, 2010
As per the book, 'childAdd' event of parentcontainer should be triggered after triggering of 'PreInitialize' and 'Initialize' event of childcontianer while as per the program out put it seems otherwise.What I found in books is as below:
Container----------Component
Preinitialize
------------------Preinitialize[code].....
View 3 Replies
Feb 2, 2011
I have a component that, once it's all ready, I need to set the state based on a variable I'm reading in from XML. I tried doing it with creationComplete, but it's apparently not ready, as the state isn't being set with elements rendering properly, but the states & rendering work fine if I do a subsequent state change with a click action on some element.
What should I do in this situation to make sure the state gets set at the right time & elements that should appear due to includeIn exist so they can be rendered? initialize instead of creationComplete doesn't seem to do the trick for the first time the component is created. Any successive calls to the component are fine.
View 3 Replies
Jan 6, 2010
I have multiple items in my app that I would like the user to click on.Some items are completely different classes.The classes dispatch events and then when the events are captured, some modifications are done to the transform properties of a loosely coupled display object.I want two separate classes to dispatch the same type of event, since I already have an image class that draws images based on a given url... I want the classes to dispatch the events, but then I think I want the difference to be detected when the event comes along... i.e., I would like to recognize the 'origin' or 'sub-type' of the event. Some sort of if/then logic would suffice.
View 1 Replies
Mar 31, 2010
I have a remoteobject within my main.mxml.I can call a function on the service from an init() function on my main.mxml, and my java debugger triggers a breakpoint.When I move the remoteobject declaration and function call into a custom component (that is declared within main.mxml), the remote function on java-side no longer gets called, no breakpoints triggered, no errors, silence.[code]
View 2 Replies
Oct 7, 2009
package classes.events
{
import flash.events.Event;
public class ASSEvent extends Event
{
public static const ALERT:String = " Add Alert";
[Code]...
View 2 Replies
Nov 5, 2009
is there any way to create a custom css value for a component and have it available to the skin class that component is using? for example, if i define this in a css file:
[Code]....
is there a way to make myCustomValue available in the PanelSkin ?
View 3 Replies
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
Dec 22, 2009
I'm making a UI for a component in Flash. I wanted to use Flex and have had no luck getting the onUpdate exernalInterface call to fire properly. I'm referencing the functionality described here: [URL]. First off, I can't embed the SWF in the FLA. It just won't start the Flex SWF. Even using the external swf, it seems that the onUpdate function is either called too early or not at all. Here's what I've tried:
Tying the externalInterfce declaration to the initialize, preinitialize, applicationComplete, and creationComplete events. Sub-classing my application and putting the externalInterface in the constructor. Neither of these options work. When I create a basic AS3 project in Eclipse and put the externalInferface in the constructor, it works as expected.
View 1 Replies
Sep 6, 2011
I need to create custom component like [code]...
Here, I need to create custom component object, changing their element values and appending that custom component in VBox. What are the correct syntax to implement this one?
View 2 Replies
Jun 16, 2010
I have built a Air 2/Flex 4 kiosk application with Flash Builder 4. Currently I am implementing a touch screen browser to enable users to navigate company training videos. In an attempt to improve the usability of the website on the touchscreen I have placed the HTML component in an adaption of Doug McCune's DragScrollingCanvas (updated to use the flex 4 'Scroller' component) to allow users to scroll the webpage by dragging their finger across the screen. The mouseDown event is used to start scrolling the viewport.
In addition the webpage was modified to disable text selection with the following css:
[Code]...
As an alternative I also tried adding a group container with the same dimensions as the HTMLLoader to detect the mouseDown events (so that the group container and HTMLLoader have the same Dragable parent container) and was able to capture mouseDown events and scroll the viewport as expected. However as the mouse event is handled by the group container, I am now unable to navigate the webpage.
View 2 Replies
May 27, 2009
Our software team has been developing flash applications using AS3 (via the FlashDevelop IDE and the free Flex SDK). Recently, some members of the team started exploring FlexBuilder and Flex (wow... why did we wait so long?). The problem is that some folks continue to develop using pure Action Script 3 (FlashDevelop) while others are creating custom components in FlexBuilder. How do the AS3 developers use the Flex Custom components built in FlexBuilder in their AS3 Applications?
View 7 Replies
May 29, 2009
I used a FlexBuilder Library Project to create a custom component library (swc). The custom component is a control bar with text fields and buttons, etc.The vast majority of our team's code is done in pure AS3 I've successfully included my new SWC in the lib and build path in our AS3 project.I've also successfully instatiated an instance of my custom component, but for some reason, it will not display. I know it exists, because 1) the compiler had no complaints, and 2) I can trace property values of the custom component and get valid output from the trace statement.
trainer.games.board.MatchThree {
import flash.display.Sprite;
public class Test extends Sprite{
[code].....
View 5 Replies
Apr 14, 2012
I am creating a custom component in Flex with extends the BorderContainer class, and I would like to be able to place additional content within the tagset when I use it in my main application, like this:
<components:CustomComponent title="Hello">
<s:Label text="If you have one enter it below:"/>
<mx:Spacer height="15" />
[Code]....
This works just fine, except that my component definition had some additional things inside of it, such as a <s:Label/> and styling, which is replaced by the content within the tagset above when I go to use it.
If I do not put anything within the tagset, the content that was originally in the component is not replaced.
Is there a way that I can simply append additional content inside of the component when I go to use it, instead of it being replaced each time?
View 1 Replies