Right click on button and show an image



Hi everyone,
I was wondering if anyone knew how to use AS3 to allow a right click on a button whose instance name is go_btn
and navigate to the next frame where an image is displayed. I tried using thefollowing script:
go_btn.addEventListener(MouseEvent.RIGHT_CLICK, pasteInfo);
function pasteInfo(e:MouseEvent):void
{
gotoAndPlay("26");
}
Flash gave error message 1119: Access of possibly undefined property RIGHT_CLICK through a reference with static type Class.
Thanks,
Robert.

Related to : Right click on button and show an image
click button, "flip" card to show next image - Help Needed
Development Tools & Services
I can't sort out what's wrong with my code (see below). Basically, I have two mc and two buttons in the library. One movieclip linked to "Card" class and has multiple frames with images in it. The other mc is empty and linked to "CardObject" class. The goal through button clicks, user can keep flipping the card and getting new image each time (or prevBtn to go back to prev frame).
OOP is new to me, I've done mostly timeline animations and simple coding right on the timeline, so excuse the mess LOL. Any and all help highly appreciated!
Quote:
Flex show image on button click
Development Tools & Services
hi guys,
pl help me.What i am going to do is that when i browse an image and click on button, the image file name should be display in textbox and image file sholud be display in image.
i have display filename in textbox but i don't how to show image file in image?
here is the code:
private
function init():void{
fileRef=new FileReference();
fileRef.addEventListener(Event.SELECT,SelectFile);
// fileRef.addEventListener(Event.COMPLETE,browseComp lete);
}
privatefunction fileUpl
Right click on button and show an image
Development Tools & Services
Hi everyone,
I was wondering if anyone knew how to use AS3 to allow a right click on a button whose instance name is go_btn
and navigate to the next frame where an image is displayed. I tried using thefollowing script:
go_btn.addEventListener(MouseEvent.RIGHT_CLICK, pasteInfo);
function pasteInfo(e:MouseEvent):void
{
gotoAndPlay("26");
}
Flash gave error message 1119: Access of possibly undefined property RIGHT_CLICK through a reference with static type Class.
Thanks,
Robert.
Strangely, two lines work after SECOND click of toggle hide/show button not FIRST click
Development Tools & Services

Everything works perfectly after the SECOND click of toggle button. Some lines work as they should on FIRST click so I know the if and else content is being entered. Please see code comments for a better understanding. Where is my logic wrong, causing these two lines not to work after the FIRST click? Even if you do not know exactly the problem, would like any ideas of what could be causing this.

   function toggleView(switchImgTag) {
        var cnt = 0;
        var but = document.getElementById("but_Toggle");
        while (cnt <= 5000) { 
            window['ele' + cnt] = document.getElementById('camimg' +
cnt);
            window['imageEle' + cnt] =
document.getElementById('camimg' + cnt);
            if (window['ele' + cnt].style.display == "block") {
             but.innerHTML = "Thumbs"; //Strangely, executes after
"second" click of List button
             window['ele' + cnt].style.display = "none"; //Strangely,
executes after "second" click of List button
             document.getElementById('im' + cnt).style.width = '20px';
//Executes after very first click of List button as it should
             document.getElementById('im' + cnt).style.visibility =
'visible'; //Executes after very first click of List button as it
should
         }
         else { 
             but.innerHTML = "List";
             window['ele' + cnt].style.display = "block";
             document.getElementById('im' + cnt).style.width = '1px';
//Executes after first click of List button as it should
             document.getElementById('im' + cnt).style.visibility =
'hidden'; //Executes after very first click of List button as it
should
         }
         cnt++;
        }
    }

Then I have the button..

<button id="but_Toggle" type="button"
onclick="javascript:toggleView();">List</button>

Then I have the content being controlled...

 retstr.AppendLine("<img alt ='" & streamref &
"'")
    retstr.AppendLine(" title ='" & Trim(image_title_with_PTZ)
& " - " & streamref & "'")
    retstr.AppendLine(" src = '" & imgsrc & "'")
    retstr.AppendLine(" class = 'item'")

    If searchbar = False Then
        retstr.AppendLine(" id = 'camimg" & count & "'")
    Else
        retstr.AppendLine(" id = 'camimg" & count & "'")
    End If

    retstr.AppendLine(" ondblclick = ""javascript:window.open('" &
imgsrc & "')""")
    'retstr.AppendLine("  data-streamurl='" &
"rtsp://1270.0.0.1/cam.stream" & "'")
    retstr.Append("/></div>")
    retstr.AppendLine("<div class='preview'")
    retstr.AppendLine(" title ='" & Trim(image_title_with_PTZ)
& " - " & streamref & "'")
    retstr.AppendLine(" id = '" & imgsrc & "'")
    retstr.AppendLine(">")
    retstr.Append("<div class=imagename><img alt ='" &
streamref & "' title ='" & Trim(image_title_with_PTZ) & "
- " & streamref & "'" & " id='im" & count & "'
src='../images/cam.png' height=20 class=item2  ondblclick
=javascript:window.open('" & imgsrc & "')><font
size=1><a href='" & imgsrc & "'>" &
image_title_with_PTZ &
"</a></font></nb></span></div></div>")

Change button text (show / hide/ show) on click in jquery toggle
Development Tools & Services

I am working on this fiddle: http://jsfiddle.net/cED6c/7/ I want to make the button text change on click and I tried using the following code:

<input type="button" class="reveal"
onClick="this.value=this.value=='Show Answer'?'Hide Answer':'Show
Answer'" value="Show Answer">

However, it does not work. How should I implement this? Any help would be great.


Show different image in pictureBox when click button and before run function C#
Development Tools & Services

I'm working on a Windows app in C#, when I click on button1 I run the function "MyFunction()". I'm trying to change the image in pictureBox1 while "MyFunction()" is running, since it takes some minutes to complete, but with the code I have so far the image desired is changed only after the execution of "MyFunction" has finished.

I see that the GUI freezes while MyFunction() is working, but I'm changing the image (pictureBox1.Image = Resource1.Working;) before to call "MyFunction();".

How can I show the image "working" in pictureBox1 inmediately before "MyFunction()" starts? Thanks

    void Button1Click(object sender, EventArgs e)
    {
        pictureBox1.Image = Resource1.Working;//To show image
"Working.jpg" while function is running

        MyFunction();

        pictureBox1.Image = Resource1.WorkCompleted;//To show image
"WorkCompleted.jpg" when function finishes

        //End of program
    }


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .