Detecting Click on an MC inside an attached movieclip

I'm working with a MovieClip ("mainMenuItem") that is linked to a Class ("GenericMenuItem.as") that uses attachMovie to add another movieclip ("Arrow") to mainMenuItem as follows:
mcArrow = this.attachMovie(prefix+"Arrow", "_Arrow_symbol", this.getNextHighestDepth());
I'm able to use on(release) within the Class definition to capture clicks on the mainMenuItem component, but haven't been able to find a way to detect a click on the "Arrow" library item that gets attached to that component.
Any thoughts?

Thanks...GenericMenuItem (the class linked to mainMenuItem, which itself doesn't have any code) doesn't have any on(release) actions inside it now. I've tried creating a separate Arrow.as class and linking it to that Arrow MovieClip symbol. I'm able to trace output inside the constructor for the Arrow class, but haven't had any luck creating an onPress/onRelease function that works there (I've tried a "this.onPress = Delegate.create(this,function()..." in the constructor, and a "public function onRelease()" in the class body without any luck in either case. I also tried adding "mcArrow.onRelease = function()" below instantiation for mcArrow in the GenericMenuItem.as class, where this is attached (ensuring that the onRelease action occurs in either the Arrow.as class or the GenericMenuItem.as, but not in both places simultaneously, to avoid conflicts). In all cases, I haven't been able to trace anything out on a click action, so don't believe it is handling clicks for this.
I'd be happy to send over project files if you'd like to take a look. Getting some pressure from a client to get this working, so any help you can provide would be immensely appreciated.
Any thoughts?

Similar Messages

  • Hi, i can't click on the 'Draw Inside' button

    i am unable to click on the 'Draw Inside' button at the bottom left to place a pattern into an image that i got off google, how can i place a pattern that i have made into my image?

    Sophie,
    It only works with a single vector object, not a raster image. My guess is that you have the latter.
    https://helpx.adobe.com/illustrator/using/drawing-basics.html

  • Detecting Clicks on Lines

    Hello,
       I am building a canvas application that allows users to drag and drop different icons on the canvas and connect them through edges. I am using the graphics of the canvas to draw these lines.
    However, one of my requirements is to detect clicks on the lines and enable users to modify edge properties. Since lines are not first class objects, it is hard to add click listeners on them. I would like to avoid doing my own click detection through MBRs, etc. Here are my questions:
    1) Is using the graphics object in the canvas to draw the lines a recommended approach? It seems cumbersome and requires me to maintain too much state
    2) Do you have suggestions on how I can detect clicks on these lines without writing my own code to see if each click interested with any of the lines?
    Thanks in advance.

    Thanks Alex. I will give that a shot. On a related note, I decided to do this in gumbo to learn my way around it. I can't seem to use Sprites properly in gumbo.
    I tried the following:
    var s: Sprite = new Sprite();
    s.graphics.clear();
    s.graphics.moveTo(0,0);
    s.graphics.lineTo(10,10);
    p.addChild(s);
    But I get the following error:
    Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.
    at spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\beta1\frameworks\pr ojects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:953]
    at Test/handleCreate()[/Users/ksshams/dev/workspaces/Adobe Flash Builder Beta2/Test/src/Test.mxml:18]
    at Test/___Test_Application1_creationComplete()[/Users/ksshams/dev/workspaces/Adobe Flash Builder Beta2/Test/src/Test.mxml:3]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\beta1\frameworks\projects\framework\src\mx\co re\UIComponent.as:11260]
    at mx.core::UIComponent/set initialized()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:1513]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\beta1\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:759]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\beta1\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1067]

  • Remove attached movieclip in reverse order of placement

    Is it possible in AS2 to remove an attached movieclip instance in reverse order? I want to give the user the ability to click an erase button and remove the most recent instance of an attached movie. I have tried .swapDepths and getting inconsistent results. Here is what I have:
    this.onMouseDown = function(){
    var drawdot:MovieClip;
    drawdot = this.attachMovie("dot", "dot_mc", this.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
    var nextdepth = this.getNextHighestDepth();
    trace (nextdepth);
    clear_btn.onPress = function() {
    dot_mc.swapDepths(100000)
    removeMovieClip(dot_mc);
    Thanks for your time.

    Perhaps using an array to store the movie clips names that are attached would work. Then you could use the array.pop() method to get the last element entered and remove it from the array at the same time.
    I bolded the lines I changed/added in your code.
    var i:Number = 0;
    var dotArrays = new Array();
    this.onMouseDown = function(){
    var drawdot:MovieClip;
    drawdot = this.attachMovie("dot", "dot_mc" + i, this.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
    dotArrays.push(this["dot_mc" + i]._name);
    var nextdepth = this.getNextHighestDepth();
    trace (nextdepth);
    clear_btn.onPress = function() {
    var delete_mc = dotArrays.pop();
    removeMovieClip(delete_mc);
    Let me know if this works ok.

  • Problem loading from an attached MovieClip

    Project: Flash Professional CS5.5 | AS3
    Platform: Mac OSX Lion
    Hello:
    I have a projector that calls on an attached movieclip with the following function:
    function fbtnclicka(e:MouseEvent):void{
    var mc:moduleexit_mc=new moduleexit_mc();
    The functions successfully loads the movieclip.
    I have a button on that movie clip that has the following function:
    function unloadexitb(e:MouseEvent):void {
        var loadera = new Loader();
        addChild(loadera);
        loadera.load(new URLRequest("credits.swf"));
        loadera.x = -479;
        loadera.y = -285;
    But the function does not load the movieclip. It simply closes the projector.
    Any reason why it does not load my movie? By the way it does work if I run the project from the swf but not from the projector.

    I used this:
    function unloadexitb(e:MouseEvent):void {
    var loadera = new Loader();
    loadera.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorF);
    loadera.contentLoaderInfo.addEventListener(Event.OPEN,openF);
    loadera.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
    addChild(loadera);
    loadera.load(new URLRequest("credits/credits.swf"));
    loadera.x = -479;
    loadera.y = -285;
    function errorF(e:MouseEvent):void {
        trace("errorF");
    function openF(e:MouseEvent):void {
        trace("openF");
    function completeF(e:MouseEvent):void {
        trace("completeF");
    and I get this:
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@2ed92859 to flash.events.MouseEvent.

  • How can attach movieclip in run time

    Hi,
    Getting some problem to attach movieclip at run time...............
    I have a shell.swf and at run time i am attaching a template.swf. In template.swf file have mcMenu Movieclip.
    I am unable to access the or attach the movieclip at run time getting this error  (1180: Call to a possibly undefined method mcMenu.)
    that movieclip is not available on the stage.... it is in the library of template.swf file. Need help
    thanks in advance
    flash@dicts

    use the applicationdomain class:
    load(yourswfURL,yourclassString);
    // you don't need to change anything below:
    function load(urlS:String, classS:String) {
        var ldr:Loader = new Loader();
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event){loadCompleteF(e,classS);});
        ldr.load(new URLRequest(urlS));
    function loadCompleteF(e:Event,classS:String):void {
        var loadedAppDomain:ApplicationDomain = e.target.content.loaderInfo.applicationDomain;
        var C:Class = loadedAppDomain.getDefinition(classS) as Class;
        var instance:* = new C();

  • Attaching movieClip from Flash(SWF) to Flex

    Hi,
    Please tell me -'How to attach movieClip of Flash file in
    Flex Application ?'
    I shall be very thankful to you
    Hoping for a favorable reply
    Thanks in Advance

    Use the Flex component kit for Flash.
    https://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins

  • Macbook Pro is detecting a second display that is not attached

    I have a first generation Core Duo Macbook Pro and have had a problem with it since it was new detecting 2 displays when only one is connected. At first it would detect 2 displays and change the notebook screen resolution to 800x600. A quick click on the Detect Displays option in the menu bar would bring it back to one display at the proper resolution. This would only occur occasionally. Lately it has been occurring with great regularity but in a different way. Now it will detect the internal display at the proper resolution but also shows that there is a VGA monitor attached with a resolution of 800x600. This usually occurs when waking the computer from sleep. the screen will come up then go all blue then come back on again. If I check the display menu the two monitors are listed and I can move the mouse completely off the screen into the ghost display. Again, clicking on the detect displays menu option detects the internal display and clears the fictitious external displays. Anyone heard of this? This computer has already had the screen and logic board replaced by AppleCare for other reasons. also, this has occurred under both Tiger and Leopard.

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • Detect click and coordinates on a PDA

    Hello everybody,
    I'm trying to detect a stylus click on a picture and the coordinates of the click on a PocketPC 2002 PDA. In the PC, this works fine with a "mouse down" event for a picture, which detects the click and the coordinates, but this event is not supported in the PDA module (ver 7.0). Another option I found for the PC is using the LV windows message queue DLL, but this is an especially written DLL and I wouldn't know how to write one for windows, let alone for windows CE, and - to make matters worse - I don't know the equivalent of User32.dll in CE. Does anyone have any suggestions?
    Thanks in advance.
    Try to take over the world!

    I managed to find that the Getmessage function allows you to access the message queue, and I found 2 files which may be relevant:
    1. coredll.dll (which as I understand from the documentation is supposed to hold the function) in "C:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300\windows".
    2. coredll.lib in "C:\Windows CE Tools\wce300\MS Pocket PC\lib\arm" which is supposed to the file to link to. There's also one in "C:\Windows CE Tools\wce300\Pocket PC 2002\lib\arm".
    When I used this coredll.dll I found a GetMessageW function and I've managed to use this on the PC to detect the click and the coordinates (when I used this DLL and was targeting the PC, a Pocket PC 2000 emulator came up and the origin for the coordinates was it's top-left corner).
    When I try to build the application (with and without the lib file), I get the error that says GetMessageW is a missing VI or C file. I attached the VI which works fine on the PC.
    Try to take over the world!
    Attachments:
    getmessage2.vi ‏30 KB

  • I click on a link inside an email and it won't open so I can print the coupon, response is http error 400 or I have it blocked. Others in my area aren't having any problems with the same link opening but they are using IE. What's up with Firefox?

    gohollywood.com, register, message came back from Hollywood Insider with a link to click on to "Download Coupon". Click on link and you should get the coupon and you print it out. All my friends have done it but I can't. I get various error messages including : "HTTP error 400 - the request is badly formed".... or you have a blocker set.....
    Unless it is a Gmail/Firefox blocker or firewall, I don't have anything set up as a blocker on my email. Had a few friends go in my account on their computers and they had the same thing happen. However when they go in under their names they get to the link with no problems. HELP.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • I Need Help In Deleting Table row by clicking on "Delete" button inside the

    Dear all,
    first i'm new to Swing
    i have created table with customized table model, i fill this table using 2d array, this table rows contains JButtons rendered using ButtonRenderer.java class and action listeners attached by the AbstractButtonEditor.java
    what iam trying to do is when i click on a specified button in table row i want this row to be deleted, i found some examples that uses defaultTableModelRef.removeRow(index), but iam using customized table model and the following is my code
    JTable tblPreview = new JTable();
              DbExpFormTableModel model = new DbExpFormTableModel();               
              tblPreview.setModel(model);
    //adding the edit button          
              tblPreview.getColumn("Edit").setCellRenderer(new ButtonRenderer());
              tblPreview.getColumn("Edit").setCellEditor(new AbstractButtonEditor(new JCheckBox()));
              //adding the delete button
              tblPreview.getColumn("Delete").setCellRenderer(new ButtonRenderer());
              tblPreview.getColumn("Delete").setCellEditor(new AbstractButtonEditor(new JCheckBox()));
    and here is the code of the code of my customized table model ( DbExpFormTableModel )
    public class DbExpFormTableModel extends GeneralTableModel
         public DbExpFormTableModel()
              setColumnsNames();
              fillTable();          
         private void setColumnsNames()
              columnNames = new String [5];
              columnNames[0] = "ID";
              columnNames[1] = "Database ID";
              columnNames[2] = "Prestatement";
              columnNames[3] = "Edit";
              columnNames[4] = "Delete";
         private void fillTable()
              int numOfRows = 2;     // = getNumberOfRows();
              data = new Object[numOfRows][5];          
              data[0][0] = "1"; //we must get this value from the database, it is incremental identity
              data[0][1] = "AAA";
              data[0][2] = "insert into table 1 values(? , ? , ?)";
              data[0][3] = "Edit";
              data[0][4] = "Del";
              data[1][0] = "2"; //we must get this value from the database, it is incremental identity
              data[1][1] = "BBB";
              data[1][2] = "insert into table2 values(? , ? , ? , ?)";
              data[1][3] = "Edit";
              data[1][4] = "Del";
    and this is the GeneralTableModel class
    public class GeneralTableModel extends AbstractTableModel implements Serializable
         public static Object [][] data;
         public static String[] columnNames;
         //these functions should be implemented to fill the grid
         public int getRowCount()
              return data.length;
         public int getColumnCount()
              return columnNames.length;
         public String getColumnName(int col)
    return columnNames[col];
         public Object getValueAt(int row , int col)
              return data[row][col];
         //i've implemented this function to enable events on added buttons
         public boolean isCellEditable(int rowIndex, int columnIndex)
              return true;
         public Class getColumnClass(int c)
    return getValueAt(0, c).getClass();
    public void setValueAt(Object value, int row, int col)
    //fireTableDataChanged();          
    data[row][col] = value;          
    fireTableCellUpdated(row, col);     
    And Now what i want to do is to delete the clicked row from the table, so please help me...
    thank you in advance

    Hi Sureshkumar,
    1. Create a value attribute named <b>select</b> of type boolean.
    2. Bind the <b>checked property</b> of all the checkboxes to this attribute.
    3. Create an action called <b>click</b> and bind it to <b>OnAction</b> event of the button(whose click will check all the checkboxes) and write this code in that action.
    <b>wdContext.currentContextElement().setSelect(true);</b>
    Warm Regards,
    Murtuza

  • Detecting clicked column in JTable (with JCheckBox in column)

    I am struggling with something that seems like it should be so simple, but it doesn't work as I expect;
    I have a table with 5 columns, the 5th column is a CheckBox. What I need to do is detect when the 5th column changes, ie. the check box is clicked;
    If I use a MouseListener on the table, and derive the table from the event, the column that I get back from getSelectedColumn() is -1, which is not conclusive. I assume this is because clicking the check box is not actually selecting the column.
    I implemented a TableModelListener as follow;
    tableModel.addTableModelListener(new TableModelListener()
    public void tableChanged(TableModelEvent e)
    System.out.println("Changed Column is " + e.getColumn() + " " + e.getFirstRow());
    This seems to do the same as before, and gives a first row of 0 and selected column of -1. Once again inconclusive.
    The cell as I say is rendered as a JCheckBox, the data in the table model obviously being Boolean.
    Can anyone suggest how I can determine if my column with a Check Box in has been clicked, and if so, which Row? (I have thought about overriding JCheckBox, but this seems more work than necessary)
    Thanks in anticipation

    You need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html]
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on
    the information provided.
    Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting] so the posted code retains its original formatting.

  • Detect clicked cluster in mouse down event for clusters within multiple stacked clusters

    With the help of Ben (see http://forums.ni.com/t5/LabVIEW/Determine-cluster-element-clicked-in-mouse-down-event/td-p/1245770)
    I could easily find out what sub-cluster had been clicked on (mouse down event) within the main cluster, by using the Label.Text Property.
    However if you have a cluster within a cluster within a cluster then you probably have to use individual mouse down events for each sub-sub cluster.
    I just wanted to use one "Main Cluster":Mouse Down event and from that determine which of the sub-sub clusters had been clicked on - is this even remotely possible?
    Chris.

    Chris Reed wrote:
    With the help of Ben (see http://forums.ni.com/t5/LabVIEW/Determine-cluster-element-clicked-in-mouse-down-event/td-p/1245770)
    I could easily find out what sub-cluster had been clicked on (mouse down event) within the main cluster, by using the Label.Text Property.
    However if you have a cluster within a cluster within a cluster then you probably have to use individual mouse down events for each sub-sub cluster.
    I just wanted to use one "Main Cluster":Mouse Down event and from that determine which of the sub-sub clusters had been clicked on - is this even remotely possible?
    Chris.
    Yes but... you will have to pass through 26 Kudos worth of Nuggets to get there (Well maybe you can skip the last 5 or so).
    This Nugget by Ton teaches us how to use Dynamic Event Registration. (15 Kudos, must read and understand)
    This Nugget by me talks about getting at references inside arbitrary data structures. (11 Kudos, You don't have to read the whole thing, only enough to get at nested objects).
    SO use the stuff I wrote about to gather up the references to the clusters. Build them into an array and then use dynamic event registration and what you learned in that thread you linked in your question.
    So Possible? Yes!
    Easy? YOU tell me.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to Display a Calender upon clicking the dropdown list inside a table co

    Hi,
    I have a Listbox inside my table control and I need to Display a Calender upon clicking the dropdown list.
    Can any body help.
    Srinivas

    Hi,
    Try this:
    On your customizing screen,
    PROCESS ON VALUE-REQUEST.          
        Field T_ZT-SDATE
          module create_dateselect.
    In your main program:
    module create_dateselect.
    data:p_date like sy-datum.
    CALL FUNCTION 'F4_DATE'
       EXPORTING
         holiday_calendar_id = 'CN'                   
         display = ' '
       IMPORTING
         select_date = p_date
       EXCEPTIONS
         OTHERS = 4.
    t_zt-sdate = p_date.
    endmodule.
    Regards,
    Pole

  • Click event on textbox inside a usercontrol WPF

    Hello,
    I'am a beginner in WPF and then i need your help!
    I try to make a usercontrol which contains a textbox. I wish I could handle the click on the texbox to eg display a popup. So I add a property ClickCommand (which would be an onclick) because it does not exist on the textbox and then to be able to bind on the
    event, so I used the DependencyProperty. But when I click on the textbox, no callback on the command binded. What is wrong?
    Xaml part of the textbox inside my usercontrol
    <TextBox x:Name="Test" Cursor="{Binding FieldCursor}">
    <i:Interaction.Triggers>
    <i:EventTrigger EventName="PreviewMouseLeftButtonDown">
    <prism:InvokeCommandAction Command="{Binding ClickCommand}" />
    </i:EventTrigger>
    </i:Interaction.Triggers>
    </TextBox>
    Binding part to manage the DependencyProperty
    public static readonly DependencyProperty ClickCommandProperty = DependencyProperty.Register("ClickCommand",
    typeof(DelegateCommand<object>),
    typeof(VariableControl),
    new FrameworkPropertyMetadata((DelegateCommand<object>)null),
    new ValidateValueCallback(IsValidClickCommand));
    public DelegateCommand<object> ClickCommand
    get { return (DelegateCommand<object>)this.GetValue(ClickCommandProperty); }
    set { this.SetValue(ClickCommandProperty, value); }
    public static bool IsValidClickCommand(object value)
    DelegateCommand<object> v = (DelegateCommand<object>)value;
    return true;

    The ClickCommand should be a property of the DataContext of the TextBox for the binding to work. If you define the dependency property in the code-behind of the UserControl class, you need to set the DataContext of the TextBox to the user control:
    public partial class VariableControl : UserControl
    public VariableControl()
    InitializeComponent();
    Test.DataContext = this;
    public static readonly DependencyProperty ClickCommandProperty = DependencyProperty.Register("ClickCommand",
    typeof(DelegateCommand<object>),
    typeof(VariableControl),
    new FrameworkPropertyMetadata((DelegateCommand<object>)null),
    new ValidateValueCallback(IsValidClickCommand));
    public DelegateCommand<object> ClickCommand
    get { return (DelegateCommand<object>)this.GetValue(ClickCommandProperty); }
    set { this.SetValue(ClickCommandProperty, value); }
    public static bool IsValidClickCommand(object value)
    DelegateCommand<object> v = (DelegateCommand<object>)value;
    return true;
    Or in the XAML:
    <TextBox x:Name="Test" Cursor="{Binding FieldCursor}" DataContext="{Binding Path=., RelativeSource={RelativeSource AncestorType=UserControl}}">
    <i:Interaction.Triggers>
    <i:EventTrigger EventName="PreviewMouseLeftButtonDown">
    <prism:InvokeCommandAction Command="{Binding ClickCommand}" />
    </i:EventTrigger>
    </i:Interaction.Triggers>
    </TextBox>
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. Please only ask one question per thread.

Maybe you are looking for