Fade in/out on button click

Hi, I'm new here and a beginner at Actionscript.
My question is this:
I want to make a photo gallery with smooth fade in and out. I
can do this on Clip Events i.e.
onClipEvent(enterFrame){
for(i=0; i>=100; i++){
myMovieClip._alpha = i;
But I can't write a script that does it on an on(release) or
hitTest.
Any help?

I recommend using Tween class instead of the
onClipEvent(enterFrame) construct.
Have a look at this nice tutorial on how to use the Tween
class:
http://www.kirupa.com/developer/actionscript/tween.htm
In the tut it is used for animation, but can as well be used
to modify the _alpha property of your MC

Similar Messages

  • Problem report only print out when i click back button

    hi all..i having problem with my report print program. the problem is my report did not immediately print out when i click print button. the program require me to click back button before print out execute. please help me to solve this problem. Thank you.
    Edited by: padile on Jan 7, 2010 3:51 AM

    Hi,
    In your program, mention the following:
    DATA: gs_out_opt TYPE ssfcompop.
    gs_out_opt-tdimmed = 'X'           "Print immediately
    CALL FUNCTION lv_fname         "Smartform FM
          EXPORTING
            output_options     = gs_out_opt  
    Regards,
    Dawood.

  • Firefox 8 and 9beta. Back and Forward buttons greyed out. Right click menu also has forward and back greyed out. Updated all plugins, then disabled all plugins and extensions and started in safe mode. No change.

    My forward and back buttons are greyed out after update to Firefox 8. Tried to move to 9 beta, but same behavior. Back and Forward also greyed out in right click menu.
    Attempted to fix by updating all plugins and extensions, then disabled all plugins and extensions, and then tried to start in safe mode. Nothing worked.

    You could have backed up your profile folder. If you did, [[Recovering important data from an old profile]] can help :)

  • How to make movieclip controlled by button fade in/out on mouse over/out?

    Hi,
    I am new to Flash, and have tried searching numerous forums to the answer to this question, but nothing I try seems to work. Basically I am trying to create a single "Image" that triggers different animations when you mouse over different invisible buttons located on specific areas. The technique I am using is basically spacing out the animations over different frames, and using the gotoAndPlay command specifying the where the relevant animation is located.
    Here is the code from my actions layer with two animations:
    stop(); /*This ensures no animations are playing on the first frame*/
    /*Mouse over event for redbutton1*/
    redbutton1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverToGoToAndPlayFromFrame_2);
    function fl_MouseOverToGoToAndPlayFromFrame_2(event:MouseEvent):void
         gotoAndPlay(2); /*This is the frame where the animaton triggered by redbutton1 is located*/
    /* Mouse Out Event for redbutton1*/
    redbutton1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_3);
    function fl_MouseOutHandler_3(event:MouseEvent):void
         gotoAndPlay(1) /*takes animation back to the start of timeline where it stops*/
    /*Mouse over event for bluebutton1*/
    bluebutton1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverToGoToAndPlayFromFrame_2);
    function fl_MouseOverToGoToAndPlayFromFrame_2(event:MouseEvent):void
         gotoAndPlay(30); /*This is the frame where the animaton triggered by bluebutton1 is located*/
    /* Mouse Out Event for bluebutton1*/
    bluebutton1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_3);
    function fl_MouseOutHandler_3(event:MouseEvent):void
         gotoAndPlay(1) /*takes animation back to the start of timeline where it stops*/
    Now basically all I need is some code that means that instead of abruptly starting and stopping the animation, the animation will fade in/out whenever the mouseover/out events are triggered. Note: the animation doesn't have to finish, it basically only plays while the mouse is over.
    Any help would be greatly appreciated.

    It will help oif you show the code for the code-based tweening.  The basics of getting it working with the MOUSE_OVER/OUR commands is fairly straightforward. 
    You have listeners for both events, and the handlers for each listener is where you activate the tweens.  For more seamless functionality it is usually a good idea to have the starting point of the tween be the point where the object currently is (its x or y (or both) propertiy) instead of a fixed value.

  • Specific region mouse over effect(Button 1 fades out and Button 2 fades in).

    Dear All -
    I am new to Flash CS5 and building Flash navigation bar with buttons on it.
    Below is my problem description that I want to solve with your help.
    I have a rectangular bar and placed one small button(Button 1) on this bar. Also, I have similar button(Button 2) with some graphics on it which is of similar size as to previous Button 1.
    Button 1 - Without graphic.
    Button 2 - With graphic on it.
    What I want is that, whenever mouse is taken over Button 1 placed on the rectangular bar, it should fade out and simultaneously Button 2 should fade in. I want only button region to be sensitive to this mouse over effect and not the complete rectangular bar.
    Kindly let me know how can I define the specific region(button region only) to be sensitive to mouse over effect in flash, and how to place Button 1 and Button 2 in layers so that both are at the same positition(so that there is no displacement of button detected).
    Thank You,
    Saurabh Khanna.

    Hello -
    Thank you for the reply. Button 1 does not have glowing effect, whereas Button 2 has a glowing effect. So what I wanted is that when initially Button 1 is loaded during page load, when I mouse over Button 1, Button 1 would fade out and Button 2 sitting behind Button 1 would automatically look like fade in(due to gradual fad out of Button 1 on top of Button 2).
    I could do this now, and would like to Thank you for your reply.
    I did this by creating movie clip on "Over" event of Button 1 and changing its Alpha property. But now what I want is how to gradually fade out, means when I remove my mouse from over button, then Button 2 should fade out gradually which will automatically make Button 1 fade in gradually.
    I could not find the "Out" event just like we have "Over" event for Button, so I assume this can only be done using ActionScript somehow.
    Let me know if I am going correct with my assumption, and possibly if you could help me achieve the remaining half(fading out gradually when mouse is removed from the button).
    Thank You once again for your reply.
    Thank You,
    Saurabh Khanna.

  • How to Figure out what checkboxes are selected upon a button click...

    If I have a panel with some JCheckBoxes and a JButton, how can I figure out what checkboxes are selected upon the button click? If I add an actionlistener to the button, inside actionPerformed, how would I know what checkboxes are selected? One caveat is that the name and number of these checkboxes are dymanically chaing based on a configuration file so I do not know what the names of these check boxes are.
    Any help/code sample would be appreciated.

    Here's one of several different ways to do it. It attaches an ItemListener to each checkBox. When the checkBox is clicked, it is either added or removed from a List of selected items. Clicking the button will show you the selected items.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class CheckBoxTest extends JFrame
      JCheckBox chkChoice1 = new JCheckBox("English");
      JCheckBox chkChoice2 = new JCheckBox("French");
      JCheckBox chkChoice3 = new JCheckBox("German");
      JCheckBox chkChoice4 = new JCheckBox("Italian");
      JTextArea txaDisplay = new JTextArea(5, 20);
      JButton btnShow = new JButton("Show Selected Items");
      ArrayList <JCheckBox>choices = new ArrayList<JCheckBox>();
      public CheckBoxTest()
        super("");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        chkChoice1.addItemListener(new CheckBoxListener(chkChoice1));
        chkChoice2.addItemListener(new CheckBoxListener(chkChoice2));
        chkChoice3.addItemListener(new CheckBoxListener(chkChoice3));
        chkChoice4.addItemListener(new CheckBoxListener(chkChoice4));
        btnShow.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event)
            txaDisplay.setText("");
            for (JCheckBox jcb : choices)
              txaDisplay.append(jcb.getText() + "\n");
        JPanel buttonPanel = new JPanel(new FlowLayout());
        buttonPanel.add(chkChoice1);
        buttonPanel.add(chkChoice2);
        buttonPanel.add(chkChoice3);
        buttonPanel.add(chkChoice4);
        JScrollPane scroll = new JScrollPane(txaDisplay);
        scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        JPanel dataPanel = new JPanel();
        dataPanel.add(btnShow);
        dataPanel.add(scroll);
        Container c = getContentPane();
        c.setLayout(new BorderLayout());
        c.add(buttonPanel, BorderLayout.NORTH);
        c.add(dataPanel, BorderLayout.CENTER);
        pack();
      public static void main( String[] args )
        CheckBoxTest frame = new CheckBoxTest();
        frame.setVisible(true);
      class CheckBoxListener implements ItemListener
        JCheckBox checkBox;
        public CheckBoxListener(JCheckBox checkBox)
          this.checkBox = checkBox;
        public void itemStateChanged(ItemEvent event)
          if (checkBox.isSelected())
            choices.add(checkBox);
          else
            choices.remove(checkBox);
    }Or, you could just maintain all the checkboxes in a Collection ahead of time. When the Show button is selected, simple query isSelected() on each item.
    Again, there are several different ways.

  • Looping without Fade in/out clicks

    Hi
    I would like to play a simple sine wave sound continuously so that it lasts one minute instead of the current 500ms. However, when I loop it I get little clicks where the beginning of the sound file fades in/out. The same clicks appear when I copy/paste it, and I don't know how to get rid of them. See attached picture to see what it looks like. Please let me know if there is a way to fix this.
    Thanks
    -Darym

    You need to edit it so that it joins up at a Zero Crossing point. Should be simple if it is a true sine wave, no crossfade should be necessary. Make sure that you have snapping to Zero Crossings turned on and you zoom in far enough to see the zero crossing.

  • Dynamically add a fade in/out transition to a caption when "showing" it from an Action?

    I have a conditional action set up where if things are not correct (text input in two entry fields), I show feedback in a caption box. I figured out how to set the caption box to be initially invisible (via unchecking the Visible checkbox for the caption's properties), and how to show it when this condition occurs. But I 'd like it to also do the traditionall transition of fade in & out when I show it fromt he action. My Advanced Action is executed when the user clicks an "OK" button.
    Any thoughts or advice?

    Yes. Plenty of media on either end. The good news is that trashing the permissions and repairing worked.
    BUT I have a question while these great minds are assembled...When repairing disk permissions the Utility says that to repair permissions on startup disk, start using my OSX install disk, which in my case is the the CD that came with my powerbook. When I tried to startup using that CD, holding down the "c" key on startup, it went into install mode. I told it I did not want to install, set the startup disk as the CD again, and kept looping around in this manner. I am probably missing a step...First question:
    1) Is it in fact necessary to start up from this CD in order to properly repair permissions?
    2) If yes, how do I get away from the install mode and to the disk utility, once the installer pops up.
    Thanks in advance. You guys are lifesavers once again.

  • Fade in/out with external SWFs

    Hi All.. I"m very new to AS in general..
    I'm trying to have a simple slideshow with external SWFs that outomatic and onClick..I achieved it except the abrupt white space after the unloaded clip goes away... I have this code and I'm not getting any errors - but I mut not have it connected somehow because the fade out is still not there... Can someone please please help me with this... I really appreciate any help ahead of thime...
    //Import classes for easier use
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    //Timer
    var slideDuration:uint = 8000;  // or use whatever
    var slideTimer:Timer=new Timer(slideDuration,0);
    slideTimer.addEventListener(TimerEvent.TIMER,autoAdvanceF);
    slideTimer.start();
    var btnA:Array = [one_btn,two_btn,three_btn];
    var previousBtn:SimpleButton = one_btn // use class type of your buttons
    function autoAdvanceF(e:TimerEvent):void{
    nextButtonF(previousBtn).dispatchEvent(new MouseEvent(MouseEvent.CLICK));
    function nextButtonF(btn:SimpleButton):SimpleButton{ // use class type of your buttons
    for(var i:uint=0;i<btnA.length;i++){
    if(btnA[i]==btn){
    return btnA[(i+1)%btnA.length];
    return null;
    //Load external SWF into main
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");
    var target_mc:MovieClip = new MovieClip();
    addChild(target_mc);
    var target_mc2:MovieClip = new MovieClip();
    addChild(target_mc2);
    //load swf to movieClip
    target_mc.addChild(loader);
    //variables that store current content clip and current content indes
    var activeTarget:MovieClip = new MovieClip();
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChildAt(loader,0);
    //Btns universal function (whenver any button is clicked, the loader will be removed
    function btnClick(event:MouseEvent):void {
        if (target_mc.alpha > 0) {
            target_mc.alpha -=10;
        if(target_mc2.alpha < 100) {
            target_mc2.alpha +=10;
    slideTimer.reset();
    slideTimer.start();
        previousBtn = SimpleButton(event.currentTarget);
        removeChild(loader);
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
        var myTween:Tween = new Tween(loader, "alpha", None.easeIn, 0, 2, 1, true);
        loader.load(newSWFRequest);
        loader.x = Xpos;
        loader.y = Ypos;
        addChildAt(loader,0);
    loader.addEventListener(Event.ENTER_FRAME, onEnter);
    // Movie level enterFrame event handler that will fade down object 1 (if it's alpha ishigher than 0) and fade up object 2 (if its aslpha is less than 100)
    function onEnter(event:Event):void {
        if (target_mc.alpha > 0) {
            target_mc.alpha -= 10;
        if (target_mc2.alpha < 1 ) {
            target_mc2.alpha +=10;
        loader.removeEventListener(Event.ENTER_FRAME, onEnter);
        trace ("the movie clip is faded in");
    /// Button Listerners
    one_btn.addEventListener(MouseEvent.CLICK,btnClick);
    two_btn.addEventListener(MouseEvent.CLICK,btnClick);
    three_btn.addEventListener(MouseEvent.CLICK,btnClick);

    The Sound Factory Studio wrote:
    Can I Fade in/out several tracks with the crossfade tool? I mean without selecting them and then add value...? just like in ProTools just selecting the regions and apply the fade tool???? VIP question
    No.
    To add crossfades or fade in/outs to multiple audio regions, you must do it from the fade parameter box, either entering numerically, or by clicking and dragging on the numeric value.

  • Creating a pop up window on button click?

    Hi
    How would I create a pop up modal window when a user clicks on a print button within an interactive report. This window would then display a message with a confirm or cancel button. If they click on confirm the page prints out and if they click cancel it takes the user back to the report
    Is this possible? if so how is this achieved?
    Many Thanks

    The confirm dialog is a native dialog in the browser. It will display a message and it has an ok and cancel button. Running it in javascript will prompt the user with the dialog, and the return value will be true or false depending on the button clicked.
    You don't need any extra page whatsoever.
    var r=confirm("Press a button");
    if (r==true)
    x="You pressed OK!";
    else
    x="You pressed Cancel!";
    }This would prompt you with a small dialog, asking "Press a button.". Clicking Ok or Cancel will return true or false to variable r, which in this code is then tested.
    You could shorten it up to
    if(confirm("Do you want to print?")){
       //execute print code
    };Alternatively, if you are on version 4.0 or higher you can use a dynamic action for this. Set the action to fire on the click of a button, and as a true action you can choose the confirm action, which then lets you display a text.

  • Open a report from button click/javascript

    Hi,
    Does anyone know if there is a way to call a report from a button click? Or through javascript? I set the report to Display Results > Link - within the dashboard and then did a view source on it and found the function that calls the report from the hyperlink.
    This is the code:
    return DashboardReportLink('saw.dll?PortalGo&amp;_scid=v-x8QJloqTY&amp;PortalPath=/shared/Plan\x2520Setup\x2520Audit\x2520Tool\x2520/_portal/Plan\x2520Setup\x2520Audit&amp;Page=Historical&amp;NavFromViewID=d\x253adashboard\x257ep\x253acp4tq3p9brn77o6o\x257er\x253a8a2g9nltmkrtra9n&amp;Path=/shared/Plan\x2520Setup\x2520Audit\x2520Tool\x2520/Archive\x2520Reporting/Run\x2520Historical\x2520Report&amp;Action=PromptStart&amp;Options=frdc', 'd:dashboard~p:cp4tq3p9brn77o6o~r:8a2g9nltmkrtra9n','Dashboard&amp;PortalPath=/shared/Plan\x2520Setup\x2520Audit\x2520Tool\x2520/_portal/Plan\x2520Setup\x2520Audit&amp;Page=Historical', false)
    I added this function to the end of my javascript but when i click the button it just opens a blank page with
    http://la820119:9704/analytics/saw.dll?PortalGo
    as the url.
    Any help would be appreciated

    Hi,
    So i have been trying out a few things and the following url works to open the default view of the request:
    window.location='saw.dll?Go&Path=/shared/Plan Setup Audit Tool /Archive Reporting/Run Historical Report&Options=dfr';
    I just replaced 'Dashboard' in the code provided with the 'Go' and it started to work :)
    What i need to do though is have this work for the session variables set up on the dashboard. I have 7 prompts which a user can use to filter a request. Each is assigned to a session variable that is used to call a stored procedure. Originally i thought that by setting the variables and then calling the report from the url that the session variable values i set would be used in the request. What seems to be happening is that the variables get set and then, on calling the url, they are reset to the defaults and the report is run.
    Any help in solving this would be very much appreciated
    Una

  • How can I display a new scene in JavaFX 2.2? For example after button click

    how to display new scene after button click in the main window, I want the main window and the new scene are in one stage. thx

    You can change the scene by calling stage.setScene(new Scene(newContentParent));
    I don't think you are quite asking for a complete scene change though as you "want the main window and the scene in one stage". The main window is a stage (as Stage extends Window). And a given stage can only contain one scene at a time (though you can swap it out by calling setScene as described earlier).
    What I think you are really asking for how can you replace some content part of the active Scene on the Stage. To do that you can set a layout manager like a HBox or a BorderPane as the root of your scene, then change out the content of the layout manager. For example:
    final BorderPane layout = new BorderPane();
    layout.setCenter(new Label("Dogbert");
    final Button nav = new Button("Next");
    layout.setLeft(nav);
    nav.setOnAction(new EventHandler<ActionEvent>() {
      @Override public void handle(ActionEvent actionEvent) {
        layout.setCenter(new Label("Dilbert"));       
    });In the above short sample code, if you wanted to change the scene rather than the a pane, then you would call stage.setScene rather than layout.setCenter.
    There is a complete executable example with multiple content panes and some styling here:
    http://stackoverflow.com/questions/13556637/how-to-have-menus-in-java-desktop-application

  • How can I get a List ID information using JScript on ribbon button click - SharePoint2010

    Dear All,
    I want to display the custom list ID column information on ribbon button click using a JScript.
    For This I have added a JScript in Layout folder in VS 2010 empty project solution and I have put
    the following Jscript code. While running and clicking the ribbon button, it seems like JScript is not
    invoking and not producing any result. It is like control is not going to Jscript file. How can I find out
    the issue???? can anyone please help me on anything wrong with my script or is
    it some-other problem which causes the blank result???
    It is a farm sharepoint2010 solution, debugging is not working in Visual Studio & IE!!!!
    Somebody please help, hard to find the error.....
    Please note the JScript Code: RibAlert.js
    <script>
    '//var siteUrl = '/sites/MySiteCollection';
    var siteUrl = 'http://a5-12457/AllItems.aspx';
    function retrieveListItems()
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Custom List');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args)
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    Please note the Elements.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="CustomRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="100"
    RegistrationType="List">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.ListItem.Manage.Controls._children">
    <Button
    Id="Ribbon.ListItem.Manage.Controls.TestButton"
    Command="ShowAlert"
    Image16by16="http://a5-12457/IconLib/ICONBTN.jpg"
    Image32by32="http://a5-12457/IconLib/ICONBTN.jpg"
    LabelText="Comapre alert"
    TemplateAlias="o2"
    Sequence="501" />
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <!-- <CommandUIHandler Command="AboutButtonCommand" CommandAction="javascript:alert();" EnabledScript="javascript:enable();"/> -->
    <CommandUIHandler Command="ShowAlert" CommandAction="javascript:alert();" EnabledScript="return true;"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    <!-- <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/DocumentTabTwo/RibButton.js" /> -->
    <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js" />
    </Elements>

    Dear All,
    I want to display the custom list ID column information on ribbon button click using a JScript.
    For This I have added a JScript in Layout folder in VS 2010 empty project solution and I have put
    the following Jscript code. While running and clicking the ribbon button, it seems like JScript is not
    invoking and not producing any result. It is like control is not going to Jscript file. How can I find out
    the issue???? can anyone please help me on anything wrong with my script or is
    it some-other problem which causes the blank result???
    It is a farm sharepoint2010 solution, debugging is not working in Visual Studio & IE!!!!
    Somebody please help, hard to find the error.....
    Please note the JScript Code: RibAlert.js
    <script>
    '//var siteUrl = '/sites/MySiteCollection';
    var siteUrl = 'http://a5-12457/AllItems.aspx';
    function retrieveListItems()
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Custom List');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args)
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    Please note the Elements.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="CustomRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="100"
    RegistrationType="List">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.ListItem.Manage.Controls._children">
    <Button
    Id="Ribbon.ListItem.Manage.Controls.TestButton"
    Command="ShowAlert"
    Image16by16="http://a5-12457/IconLib/ICONBTN.jpg"
    Image32by32="http://a5-12457/IconLib/ICONBTN.jpg"
    LabelText="Comapre alert"
    TemplateAlias="o2"
    Sequence="501" />
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <!-- <CommandUIHandler Command="AboutButtonCommand" CommandAction="javascript:alert();" EnabledScript="javascript:enable();"/> -->
    <CommandUIHandler Command="ShowAlert" CommandAction="javascript:alert();" EnabledScript="return true;"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    <!-- <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/DocumentTabTwo/RibButton.js" /> -->
    <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js" />
    </Elements>

  • Resizing JFrame on button click to show an image on the JFrame

    Dear All,
    I have a JFrame which has an empty label. On button click I want to set an icon for the label and want the JFrame to be resized to show that icon. I am using frame.pack() and I am not using any other sizing function. The code that I have right now, prints the image on the panel, but does not resize the frame to show the image. Pleae could someone help.package gui;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class ComponentDemo extends JPanel implements ActionListener,
    ItemListener, MouseListener, KeyListener {
         private JTextArea textarea;
         private JButton button;
         private final static String newline = "\n";
         private JLabel imageIcon;
         public ComponentDemo() {
              button = new JButton("JButton welcomes you  to CO2001");
              button.addActionListener(this);
              add(button);
              textarea = new JTextArea(10, 50);
              textarea.setEditable(false);
              addMouseListener(this);
              textarea.addKeyListener(this);
              JScrollPane scrollPane = new JScrollPane(textarea);
              add(scrollPane);
              imageIcon = new JLabel();
              add(imageIcon);
              setBackground(Color.pink);
              new JScrollPane(this);
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event-dispatching thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("Simple FrameDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              frame.setLocation(700, 200);
              // get the content pane and set the background colour;
              frame.add(new ComponentDemo());
         //     frame.setSize(screenSize);
              // frame.getContentPane().setBackground(Color.cyan);
              // Display the window.
              frame.pack();
              frame.setVisible(true);
              frame.setResizable(true);
         public static void main(String[] args) {
              // Schedule a job for the event-dispatching thread:
              // creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
         @Override
         public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              if (e.getSource() instanceof JButton) {
                   // System.out.println(e.getSource());
                   String text = ((JButton) e.getSource()).getText();
                   textarea.append(text + newline);
                   textarea.setBackground(Color.cyan);
                   textarea.setForeground(Color.BLUE);
                   textarea.setCaretPosition(textarea.getDocument().getLength());
                   imageIcon.setIcon(createImageIcon("SwingingDuke.png",
                   "Image to be displayed"));
         @Override
         public void itemStateChanged(ItemEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseClicked(MouseEvent arg0) {
              textarea.append("A Mouse click welcomes you to CO2001" + newline);
              textarea.setBackground(Color.green);
              textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void mouseEntered(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseExited(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mousePressed(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseReleased(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void keyPressed(KeyEvent e) {
              System.out.println(e.getKeyChar());
              textarea.append("The key " + e.getKeyChar()
                        + " click welcomes you to CO2001" + newline);
              textarea.setBackground(Color.YELLOW);
              textarea.setFont(new Font("Arial", Font.ITALIC, 16));
              textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void keyReleased(KeyEvent e) {
              System.out.println(e.getKeyChar());
              // textarea.append("The key "+
              // e.getKeyChar()+" click welcomes you to CO2001" + newline);
              // textarea.setBackground(Color.green);
              // textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void keyTyped(KeyEvent e) {
              // TODO Auto-generated method stub
              System.out.println(e.getKeyChar());
              // textarea.append("The key "+
              // e.getKeyChar()+" click welcomes you to CO2001" + newline);
              // textarea.setBackground(Color.blue);
              // textarea.setCaretPosition(textarea.getDocument().getLength());
         /** Returns an ImageIcon, or null if the path was invalid. */
         protected ImageIcon createImageIcon(String path, String description) {
              java.net.URL imgURL = getClass().getResource(path);
              if (imgURL != null) {
                   System.out.println("found");
                   return new ImageIcon(imgURL, description);
              } else {
                   System.err.println("Couldn't find file: " + path);
                   return null;
    }

    myJPanel.setPerferredSize(new Dimension(new_width, new_hight));
    myJFrame.pack();

  • CRM5.2 UI-Call a dynamic URL on button click

    Hi all, 
               My requirement is to call a dynamic url on the click of a button in the overview page. I have added a custom button in  the method  IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS , and the related code in do_handle_event.I have created a custom method for the button event. I have enhanced a custom controller and created an attribute.In the custom method created for the button event, I have written the code for retrieving the parameters to be passed to the url.
    In the layout of the view associated with the display view , I have written the following code for calling the URL in a new window.
    <%
    DATA: lr_cuco_EMA TYPE REF TO ZL_BP_CONT_BPCONT_IMPL,
          lv_url TYPE string,
          lv_url1 type string,
          lv_count type i.
      lr_cuco_EMA ?= controller->get_custom_controller( 'ZBP_CONT/BPCONT' ).
      check lr_cuco_EMA is bound.
      if lr_cuco_EMA->gv_VALUE is not initial.
      if lr_cuco_EMA->gv_COUNT IS NOT INITIAL.
      clear lr_cuco_EMA->gv_COUNT.
      endif.
      LV_URL = lr_cuco_EMA->gv_VALUE.
      Concatenate 'http:/' LV_URL  into LV_URL1.
      Concatenate '"http:/' LV_URL '"' into LV_URL.
        lv_count = lr_cuco_EMA->gv_COUNT mod '2'.
        if lv_count Ne 0.
      lv_url = lv_url1.
    endif.
      %>
         <scrpt language="Javascript">
            window.open(<%= lv_url%>).focus();
          </script>
       <%
             lr_cuco_EMA->gv_COUNT = lr_cuco_EMA->gv_COUNT + 1.
             clear lr_cuco_EMA->gv_value.
             clear lv_count.
             clear lv_url.
             clear lv_url1.
             ENDIF.
    %>
    But here my URl is getting called alternate times.If I do not write the code  by using the variable GV_COUNT the url is getting called only the first time of the button click  and to call the URL again you need to navigate back to the search page and again back to the overview page and click on the button.
    Can anyone help me regarding this? I want the URL to be called in a new page on every button click.
    Thanks in Advance,
    Chandana

    Hi Nisha,
    The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
    function fn_button()
               htmlbSL(this,2,'b_row_selection:onInputProcessing()');
               window.open("new_page",target="BLANK");
    Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
    Try this out and let us know if it works for you.
    Regards,
    Saurabh

Maybe you are looking for

  • My N97 consumer feedback

    Hello, I could not find any place to provide a concrete consumer feedback. Discussed the issue with Nokia Care Line numerous amount of times and while the issue gets escalated higher, nothing tangible has ever been realized. So I decided to post this

  • Windows won't install and can't get back to mac os

    I printed boot camp instructions.  I partitioned the disk with no problem, inserted windows 7 and it came up a black screen with blinking cursor.  I cannot get out of it and if I restart, it says to insert bootable disk.  I cannot get mac os to come

  • Flash Problems. Update unrecognized by computer

    Hi, originally it was a Safari problem, but now a program I purchased called BannerZestPro, refuses to launch as it says my flash player is too old. I have run the latest install numerous times, trashed the internet plugin file (new one each time say

  • Simple Select statement in MS Access

    I am not able to get this simple select statement working in MS Access. "SELECT PhotoLocation from RfidData WHERE TeamID = '"+teamID ; It is using a variable called teamID which is a string. The error is java.sql.SQLException: [Microsoft][ODBC Micros

  • Sdo_geom.relate operator (urgently)

    i have got two roads features one from large scale second from small scale my task is to extract features of common means intersection i have drawn a buffer around the small scale feature which has two records NO UFI 1 BB06104925 2 BB06104928 other o