Onclick event in flash

Hello,
i have an flv  movie file that i need to convert to swf and add an onclick event to  it. i was able to do the first step by importing the flv movie and  export it as swf. how can i add the onclick event? this swf will be an  advertisement for a product and onclick i need it to redirect to a  specific URL.
thank you in advance.
Oliver

Create a new layer with an invisible button (set its alpha to 0) and add the clicking code needed.
The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So while it's selected on the stage, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"
In AS3, to make a button work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:
btn1.addEventListener(MouseEvent.CLICK, btn1Click);
The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:
function btn1Click(evt:MouseEvent):void {
   var url:String = "http://www.awebsite.com/awebpage.html";
   var req:URLRequest = new URLRequest(url);
   navigateToURL(req, "_blank");

Similar Messages

  • Capture onclick event on flash object using javascript

    May the admins forgive me if this is in the wrong forum.
    How to capture the onclick event on a web page when the click
    happens on an embedded flash object?
    You can't. At least not in IE. For some arcane reason either
    microsofts developers or the flash guys decided to overrule the DOM
    in IE.
    So the onclick event is never fired, in any browsers, when
    the user clicks an embedded flash object like this:
    However there's a workaround. Add the wmode="transparent"
    parameter. This make the onclick event okay in Firefox, but still
    not IE - where the flash movie is transparent the click event
    fires, but only those places.
    Instead use the onmousedown and onmouseup events which fires
    anywhere on the flash.

    >
    I tried each of the following in the the Element HTML Form Element Attributes for the File Browse item:
    onClick=javascript:alert(this.value);
    onClick=javascript:popupURL('http://www.google.com');
    onFocus=javascript:alert(this.value);
    onChange=javascript:alert(this.value);And what happened?
    [A few points on good practice:
    1. In the XHTML normally used in APEX 4.0 mark-up, all XHTML, including attribute/event handler names, should be in lower case: <tt>onclick</tt>, <tt>onfocus</tt>, <tt>onchange</tt>...
    2. Attribute values should always be quoted.
    3. The <a href="http://crisp.tweakblogs.net/blog/313/the-useless-javascript-pseudo-protocol.html">"javascript:" pseudo-protocol is evil</a>. There are a few places in APEX where we may have to resort to using it as URL is all we're offered to work with, but it's always better to use an event handler of some kind, either inline or (better) registered dynamically at runtime following the principles of <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">unobtrusive JavaScript</a>. +It absolutely should not be used in inline event handlers.+
    So:
    {code}
    onclick="alert(this.value);"
    etc

  • Javascript attach onClick event

    I have some Flash 3rd party objects on my website that are
    used for various reasons. I'd like to know when a user clicks on
    them, but I don't have access to the source.
    Is it possible to attach OnClick events to a Flash object via
    javascript? Or is there a recommended way to receive notification
    when a click occurs on the Flash object?
    In Javascript I can get the object in question, but I haven't
    found a way to attach onClick events. Please help.

    You can set up systems to catch click-throughs, but they
    require the correct line of code to be put into the Flash movie
    (which you've said you can't do)
    I take it you've tried adding an onClick="..." attribute to
    the object tag?
    e.g. just test it with:
    <object onClick="alert('This works!');" etc
    >...</object>
    Then try clicking on the movie and see if an alert box pops
    up... I can't say I've tried it though, it's quite likely when the
    Flash is active it handles all mouse responses so the javascript
    might not detect them

  • Unable to capture onClick event of htmlb:image in a controller

    Hi,
    I am trying to capture onClick event of an htmlb:image (which is present in my view) in DO_HANDLE_EVENT method of my controller.
    Surprisingly, when I click the image, page does refreshes. But the event in not captured in do_handle_event method. Control never reaches that method. Whereas if I put onClick event of a button, it is easily captured in do_handle_event method.
    Ex. code in my view is:
    <%@page language="abap"%>
    <%@extension name="bsp" prefix="bsp" %>
    <%@extension name="htmlb" prefix="htmlb"%>
        <htmlb:image id      = "searchimg"
                     src     = "consvalue.jpg"
                     onClick = "search"  />
        <htmlb:button id="searchbutton" onClick="search"
                                     text="Event Test"/>
    Now, the button event is captured, but not the image event.
    Any idea why this might be happening?
    Regards,
    Kaushal

    Hi Kaushal,
    are image and button enclosed by <htmlb:form> ?
    Please post your of do_handle_event, where you look for the event.
    Regards,
    Sebastian

  • Can't set a hidden field value from onClick event with a runtime expression

    Hi,
    I need to set a hidden field in an onClick event of button but it's not working.
    <html:submit styleClass="btnLink" onclick="document.empForm.hidden.value='<%= empID%>'">
    <%= empID%>
    </html:submit>
    Althought the second expression is evaluated and written successfully "the button value"
    I heard that this is because you can't mix the value of an attribute of a custom tag with both string literal and run time expressions.
    Is there any work around to solve that?
    I can't use EL as I'm using old JSP version

    I guess, it should work; instead of html:submit, try with button.

  • Using javascript to detect the onclick event over a datatable row

    Hi all,
    I'm working with JSF 1.2 R.I. and I would like to add some javascript to my datatable to be able to control the onclick event on a row.
    At the moment I have just added a checkbox to be able to know which row the user wants to select but I'm not satisfied with this solution.
    <h:dataTable
    value="#{person_iupopulations_Observation.customer}" var="customer"
    rowClasses="evenRow,oddRow"
    cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Select" />
    </f:facet>
    <h:selectBooleanCheckbox value="" onclick="getRow(this)">
    </h:selectBooleanCheckbox>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name" />
    </f:facet>
    <h:outputText value="#{customer.Name}"></h:outputText>
    </h:column>
    </h:dataTable>
    What I would like to achieve is:
    When the user clicks the row (wherever, not only the checkbox) the checkbox changes to the new value depending, off course, on the user's selection.
    For this purpose I would need to add the onclick event to every row and associate it to a javascript function to update the checkbox.
    Can anybody help me please.
    I appreciate any suggestion.
    Thanks in advance!

    I am looking for answers on how to use javascript to detect the onclick event over a datatable row . I have a selectBooleanCheckBox in one of the columns in the every row in the table. On click of the checkbox in any row of the table, I want to get some values from the selected row and also verify that the rest of the checkboxes in all the other columns are unchecked. I want to do this using javascript. If any of you have answers, please repsond. Thanks.

  • Catch the onClick event on Interactive Report to access columns content

    Hi,
    I am using Apex 4
    I would like to display some rows into an interactive report. I have define a dynamic action on that report in order to catch the Mouse OnClick Event.
    The Goal is to display the detail of the row in a form region in the sidebar.
    To do this, I would like to get the content of a column of the row clicked and then execute a pl/sql block to get the detail of my row.
    I am stuck to get the content of the column I have clicked within the dynamic action to pass it to execute the pl/sql block.
    Any idee?
    Many thanks
    jko
    Edited by: user617942 on 29-Jul-2010 04:19

    Hello,
    Did I ask something stupid :-)
    Jko
    Edited by: user617942 on 29-Jul-2010 04:19
    Edited by: user617942 on 29-Jul-2010 08:34

  • OnClick event in swf file stops a WMP movie that is being play

    Hi
    When placed in the same page - onclick event in a swf file
    stops a WMP movie that is being play.
    I've tryied to add another div with ontop positioning. but it
    didn't work.
    I've added a dlear image and it worked but the SWF mouseover
    and mouseclick events disappeared.
    Can someone help me?
    PS - it happens only on IE.
    Thanks.

    Hi Alden,
    I fear your problem might be the file size (system resources,
    actually) of your project. And if that is the case, it will
    adversely affect your end users as well, so best find our
    definitively right away. But let's assume for a minute that the
    file size is
    not causing the problem ...
    Are there any interactive object(s) on the 33rd slide (or
    thereabouts) that might be causing the project to stop - like a
    button, click-box, or text-entry box???
    A 48 slide movie is not (in and of itself) overly large, so
    hopefully you can find some overlooked object that is causing the
    problem...
    .

  • Input Field in table - I need a OnClick Event

    Hello everybody,
    I have the following problem:
    I have created a table in my view which is filled at runtime. The table has 3 different rows and every row has TableSingleMarkableCells, these cells further have a input field as their celleditor.
    I now want to know which cell the user is editing. I have a AttributePointer through which I know that at the time the user presses the enter key. But I need to know whether the focus has changed. Because there is the possibility that the user switches between the differnt cells with the arrow key or the tab key. But the AttributePointer only gives me the first selected cell.
    Have anybody a suggestion to solve this problem -  it seemed to be something like definingb a OnClick event for a input field (additionaly to the default OnEnter event...)
    Best regards,
    Sebastian

    Hi,
    You can find out at which row the editing goes, by using
    onLeadSelect action of TableUIElement.
    in onLeadSelect action you can find row number using this statement
    int rownumber= wdContext.node<TableNode>().getLeadSelection();
    Regards
    LakshmiNarayana

  • Trouble Passing Values Using onClick Event

    I have a page with a div, <div id= PF_Text_Panel></>,  containing text describing an image, the image is in a separate div.  Using CSS the text panel is on top of the image and covers about 1/3 of the image’s left side.  A slide effect, handled by the function Slide, targets the PF_Text_Panel div. The function Slide is triggered by an onClick event allowing the user to slide the description to the left and reveal the entire image.
    The function Slide contains an if statement. The if statement is used to determine if PF_Text_Panel is open or closed using the variable SldPnlState  as a flag like this; if the variable SldPnlState ==1, then run Slide.  The other part of this function, which actually slides the div is an instance of the Slide Effect, inserted using Dreamweaver CS4.
    The variable SldPnlState  is set using the function setSldPnlState
    The function setSldPnlState, initiated by an onClick, passes a value to the variable SldPnlState, in this case it can be set to either 0 or 1 by separate onClick events
    To test if the variable SldPnlState is being passed from the onClick event to the variable I included the function printVar which writes the value of the variable SldPnlState to the screen.
    I believe that the Spry effect Slide portion of the function works because if I go into the code and manually set the variable SldPnlState to 1 the function Slide works and if I set it to 0 the function Slide does not work.
    This the bug:
    printVar indicates that the value is being passed the variable SldPnlState, it displays either a 1 or 0 as expected. 
    The function Slide does not work however, when the variable SldPnlState should be set by the onClick event passing the value using the function setSldPnlState.  It does not seem like the value is being passed from the onClick event triggering the function or that somehow the script stops running.
    You can demo the page at: http://dg-ad.com/Slide_Effect_Logic_Parameter.html
      Attached is the code, if anyone has some suggestions I would really appreciate hearing from you
    <!--begin setup Spry Effects-->
    <script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
    <!--Begin pass variable from flagToggle parameter to SldPnlState variable includes printVar function to sent results to screen-->
    <script language="javascript" type="text/javascript">
    <!--begin set flag using onclick event-->
    var SldPnlState = (1);
    function setSldPnlState(flagToggle)
    SldPnlState = flagToggle;
    </script>
    <!--end set flag using onclick event-->
    <!--begin slider onclick event-->
    <script type="text/javascript">
    if(SldPnlState==1)
    function MM_effectSlide(targetElement, duration, from, to, toggle, transition, fps, horizontal)
    Spry.Effect.DoSlide(targetElement, {duration: 500, from: 0, to: 200, toggle: true, transition: 2, fps: 750, horizontal: true});
    //-->
    </script>
    <!--end slider onclick event-->
    <!--begin write variable onclick event-->
    <script type="text/javascript">
    function printVar()
    document.getElementById('test_display').innerHTML = SldPnlState
    </script>
    <!--end write variable onclick event-->
    </head>
    <body id="wrapper">
            <div style="padding-top:50px;">
            <a href="#" onclick="setSldPnlState(1);">Set var SldPnlState to Flag Status Set Open (1)</a><br><br><br>
            <a href="#" onclick="setSldPnlState(0);">Set var SldPnlState to Flag Status Set Closed (0)</a><br><br><br>
            <a href="#" onclick="printVar();">Print Flag Status to Screen</a><br><br><br>
            <div id="test_display" style="border:#9CC thick groove; width:50px; height:50px; margin:15px; text-align:center; font-size:36px;"></div>
            <a href="#" onclick="MM_effectSlide('PF_Text_Panel');">Slide Panel</a><br><br>
            </div>
    <div id="PF_Text_Panel" style="border:#9C9 thick solid; height:250px; margin-top:25px;">
      <div id="PF_Text" class="PF_Text">
      </div>
      <script type="text/javascript">
        var panelWidget_1=new Spry.Widget.HTMLPanel('PF_Text');
        </script>
    </div>

    Thanks so much for taking a look at this.  The whole reason I am doing this is that I couldn't find a state indicator flag in the Spry.Effect.DoSlide effect.
    I see that the htmlPanel does not have a bearing on the problem as you mentioned but not having the javascript doesn't matter either.  I am using the Spry.Effect.DoSlide effect, it is in the head,  in the function with the if statement, and it is making the div"PF_Text_Panel slide which works fine including the if statement.  If I set the var SldPnlState = (1) it works set it to 0 and the slide effect is disabled.  I need to be able to change the variable using an onclick event.
    The problem as you mention is with the function SldPnlState = flagToggle;  This is what I need to do.  I need to pass a value to  the variable SldPnlState from an onclick event.  As the function Slide is set up, with an if statement, the div will slide if SldPnlState=1 and the slide function will turn off if SldPnlState=0.  However when I do the onclick="setSldPnlState(1);"event there is no effect on the Slide function.  The value seems to pass to the variable tSldPnlState since I can get the value of this same variable to display using the function printVar() which will display 1 or 0 depending on which onclick event I run.  It seems like the I can pass the variable from the onclick event it's just that if statement in the function MM_effectSlide never sees it.  I don't know enough to trouble shoot this.  But I will take a closer look at the SldPnlState = flagToggle; part as you suggest.

  • Error in form submit through netui:anchor tag onClick event

    Hello,
    I am working on a portal application. Below is my jsp code of a simple search screen. The search parameter is customername.
    <netui:form action="searchCustomer" style="form" tagId="myForm">
    <netui:textBox dataSource="{actionForm.customerName}"></netui:textBox>
    <netui:anchor onClick="sayHello(); return false;" styleClass="button" action="searchCustomer" formSubmit="true"> Search</netui:anchor>
    </netui:form>
    I have an onClick event as I want to implement some customer logic on click of the anchor tag.
    function sayHello(){
    // customer implementation here
    document.forms[getNetuiTagName("myForm",this)].method="POST";
    document.forms[getNetuiTagName("myForm",this)].action="/searchCustomer.do";
    document.forms[getNetuiTagName("myForm",this)].submit();
    In the searchCustomer method of the controller, the form has zero parameters. The customerName has null value.
    Can anyone tell me what am I doing wrong here.
    Any help is appreciated.
    Thanks
    Manju

    I also want to add a confirm() dialog before submitting. However, setting the onClick handler overrides the one generated when formSubmit="true". I worked around this by calling the generated function directly:
    <... onClick="if (confirm('[msg]')) { anchor_submit_form(getNetuiTagName('[formName]'), this.href) } return false;">
    Where [msg] is the message to display and [formName] is the name of the form containing the anchor.
    Hope this helps someone.

  • EP 6.0 SP2: Update a HTMLB TableView after onClick Event

    Hello,
    i generate a TableView from a JDBC database selection.
    Outside this TableView there are 3 Buttons.
    Now the problem:
    If one of the buttons will click, the TableView has to be updated with a new database result. Have somebody an idea, how to update the TableView?
    Stephan

    Could you be more precise?
    Default behaviour/coding is that an onClick event effects a request to the server - as your component/dynpage handles this request, you should be able to present anything that you like on this occasion. Maybe you code does not react to the HTMLB event properly?
    Regards,
    Armin

  • How to invoke a Servlet on onClick event of CheckBox ?

    Hi,
    Can anybody provide me with the code - how to invoke a Servlet & then pass all form variables to the Servlet on onClick Event of CheckBox in a JSP Page.
    I guess it is possible with Javascript but i need the code...
    Pls Help !
    Thanx.

    <html>
    <head>
    <script language="JavaScript">
    <!--
    function submitMyForm(){      
    document.myform.submit();
    //-->
    </script>
    </head>
    <body>
    <form name="myform" method="POST" action="http://mywebserver/servlet/myServlet" target=_top>
    <input type="checkbox" name="mycheckbox" OnClick = "javascript:submitMyForm()">
    </form>
    </body>
    </html>
    Hope this helps...

  • [svn:cairngorm3:] 16810: Changed close event from flash.events.Event. CLOSE to mx.events.CloseEvent.CLOSE.

    Revision: 16810
    Revision: 16810
    Author:   [email protected]
    Date:     2010-07-03 03:32:49 -0700 (Sat, 03 Jul 2010)
    Log Message:
    Changed close event from flash.events.Event.CLOSE to mx.events.CloseEvent.CLOSE. See MXML examples in PopupTest.
    Modified Paths:
        cairngorm3/trunk/libraries/PopupTest/src/samples/ModulePopups.mxml

    Hmmm Strange!!!
    Seems like a bug which requires target for parallel effect while hide only but does not set it.
    For the time being you can remove the sequence effect as there is no othe effect other than parallel and use effect like
             <mx:Parallel id="fadeOutTw">
                <mx:Fade alphaFrom="1.0" alphaTo="0.0" duration="1000"/>
                <mx:WipeUp duration="1000" />       
            </mx:Parallel>
    or you can also set target explicitly like :
    <mx:Sequence id="fadeOutTW" >
            <mx:Parallel target="{largeImgTW}">
                <mx:Fade alphaFrom="1.0" alphaTo="0.0" duration="1000"/>
                <mx:WipeUp duration="1000" />       
            </mx:Parallel>   
        </mx:Sequence>
    I have tested on this code, and works fine. Hope this helps you
    -Vikash

  • [svn:cairngorm3:] 16809: Changed close event from flash.events.Event. CLOSE to mx.events.CloseEvent.CLOSE.

    Revision: 16809
    Revision: 16809
    Author:   [email protected]
    Date:     2010-07-03 03:05:21 -0700 (Sat, 03 Jul 2010)
    Log Message:
    Changed close event from flash.events.Event.CLOSE to mx.events.CloseEvent.CLOSE. See MXML examples in PopupTest.
    Modified Paths:
        cairngorm3/trunk/libraries/PopupTest/.actionScriptProperties

    Hmmm Strange!!!
    Seems like a bug which requires target for parallel effect while hide only but does not set it.
    For the time being you can remove the sequence effect as there is no othe effect other than parallel and use effect like
             <mx:Parallel id="fadeOutTw">
                <mx:Fade alphaFrom="1.0" alphaTo="0.0" duration="1000"/>
                <mx:WipeUp duration="1000" />       
            </mx:Parallel>
    or you can also set target explicitly like :
    <mx:Sequence id="fadeOutTW" >
            <mx:Parallel target="{largeImgTW}">
                <mx:Fade alphaFrom="1.0" alphaTo="0.0" duration="1000"/>
                <mx:WipeUp duration="1000" />       
            </mx:Parallel>   
        </mx:Sequence>
    I have tested on this code, and works fine. Hope this helps you
    -Vikash

Maybe you are looking for