Simple button in AS3

hello everybody,
in my website I have a simple button that should trigger at
every click a different frame. Browsing the net I have found the AS
for the simple button (attached code) that works for a sigle click.
Would please tell me the AS to give to the button the
function described above??
thank you so much

My line would replace the gotoAndStop(2) that you had in your
previous code. But I'm not sure that it is what you want. The code
I gave you will tell the thing you clicked on to go to frame 2 and
only to frame two.
I think you are trying to do something different that what I
thought. I think what you want instead of your gotoAndStop() line
you just want
nextFrame();
Of course you might want to do something special when you get
to the last frame so you might want to add something like:
if(currentFrame==totalFrames){
next.removeEventListener(MouseEvent.CLICK, release);
next.alpha=.5;
That would go just after the nextFrame(). That checks to see
if the current frame is the last one and if so removes the click
handler from the next button and makes it transparent so it looks
disabled. (That could be done in a lot of fancier ways, but this
was just to give you the idea.)
Does that help?

Similar Messages

  • Adding Image to Simple Button Dynamically Using AS3

    Hi,
    I need some help trying to figure out how to dynamically add an image (PNG or JPEG) that I can place in the library to a simple button also dynamically created in AS3.
    Is there a way to (1) add the image instead of using a text label and have it centered in the button?
    Here's the AS3 for the simple button without the image (currently uses text label but would prefer if possible to substitute an image for the text:
            var mc2:MovieClip = new MovieClip();
            mc2.addChild( bgRed2 );
            mc2.addChild( txt2 );//currently uses text label; would prefer to use an image istead of text
            var mc2a:MovieClip = new MovieClip();
            mc2a.addChild( bgRed2a );
            mc2a.addChild( txt2a );currently uses text label; would prefer to use an image istead of text
            var clearBtn:SimpleButton = new SimpleButton();
            clearBtn.upState = mc2;
            clearBtn.overState = mc2a;
            clearBtn.downState = clearBtn.upState;
            clearBtn.hitTestState = clearBtn.upState;
            clearBtn.x = 0;
            clearBtn.y = 0;
            addChild( clearBtn );
            clearBtn.x = 55;
            clearBtn.y = stage.stageHeight-clearBtn.height;
    Any help appreciated.

    assign your image a class name (eg, Img1). you can then use:
    var img1D:BitmapData=new BitmapData();
    var img1:Bitmap=new Bitmap(img1D);
    cleanBtn.upState=img1; // for example, button's upstate is the image.
    // if you wanted some background and the image centered on the background, create your background (sprite or movieclip), use addChild to add img1 to your background and center it.  then assign your button's upState etc to be your background

  • Buttons in AS3??????

    I used to use a script like this in a frame on the timeline
    to add functionality to my buttons.
    btn_01.onRelease = function(){
    _root.targ_Main.loadMovie("oranythingelseineededthebuttontodo");
    Now in AS3 I have no clue!!!!!!!!!!
    And apparently you have to be some sort of uber programmer
    just to read the documentation. Can anyone tell me how to make a
    simple button work?

    leodsmith,
    > Now in AS3 I have no clue!!!!!!!!!!
    Yes, things have changed, but keep in mind, you don't *have*
    to use AS3.
    Your publish settings (File > Publish Settings) let you
    configure any FLA
    for ActionScript 3.0, 2.0, 1.0, and even older versions
    (precursors, really)
    of the language.
    > And apparently you have to be some sort of uber
    > programmer just to read the documentation.
    I realize it can feel that way, but there's a trick to
    figuring out the
    documentation, and it call comes down to something called
    classes. In a
    nutshell, classes are like recipes, or blueprints, for the
    objects you now
    and use every day in Flash. If you're using a button symbol,
    you're
    actually dealing with a button object; that is, an instance
    of the Button
    class in AS2 or the SimpleButton class in AS3. If you're
    using a movie
    clip, you're dealing with an instance of the MovieClip class,
    regardless of
    the version of AS. Text fields are defined by the TextField
    class. Sounds
    are defined by the Sound class, and so on.
    ActionScript 3.0 has a larger API (more classes) than
    previous versions,
    but it's structured the same way. For example, AS3 provides a
    set of
    companion classes for audio: Sound, SoundChannel,
    SoundTransform, and
    SoundMixer. AS2 only provides a Sound class. On the face of
    it, that may
    seem easier because it's less to deal with ... but every coin
    has two sides.
    In AS2, the concept of a sound channel is present (this is
    the thing that
    lets you differentiate between different "sound banks"), but
    there is no
    SoundChannel class. Instead, AS2 associates Sound instances
    with a
    particular timeline (that is, with a movie clip) ... so even
    if AS2 is more
    familiar, it isn't always as intuitive as it should be.
    Okay, back to classes. So classes define objects, and as a
    general
    rule, classes are categorized into three headers: Properties,
    Methods, and
    Events. Sometimes you'll see a few more, but those three are
    the main ones.
    Properties refer to an object's characteristics (width,
    height, number of
    letters, volume, etc.). Methods refer to things the object
    can do
    (gotoAndPlay(), setTextFormat(), attachAudio(), etc.).
    Finally, events
    refer to things the object can react to (mouse ups, the end
    of an audio
    file, the passing of a timeline frame, and so on.)
    So if you're looking up something about buttons, try the
    SimpleButton
    class in AS3, or the Button class in AS2 (usually, the class
    names are the
    same for both versions; this happens to be an oddball). Look
    up events, to
    see what sort of "can react to" opportunities exist for
    buttons, then check
    out the sample code. Granted, that may be easier said than
    done -- new
    stuff is always bewildering until you get familiar with it --
    but I hope
    that at least helps you get your bearings. Be aware that most
    classes
    inherit functionality from each other (just like genetics in
    humans), so
    when you see hyperlinks in the documentatoin for showing
    inherited
    properties, methods, or events, be sure to click them!
    In this case, as NedWebs correctly pointed out, you're going
    to use the
    addEventListener() method to associate a particular
    MouseEvent with a custom
    function. In principle, this is the same way it happens in
    AS2 (unless
    you're attaching code directly, which AS3 doesn't support).
    AS2:
    btn_01.onRelease = function() {
    // something to do
    Here, you're using an anonymous function (meaning, the
    function isn't
    named). You could also do this:
    btn_01.onRelease = clickHandler;
    function clickHandler() {
    // something to do
    ... which, on a certain level, is pretty much the same thing.
    Giving your
    function a name is arguably better, becuase if you ever need
    to kill that
    event handler, you can set it to null:
    btn_01.onRelease = null;
    ... and then, if you ever need to re-enstate that event
    handler, you can
    simply re-associate it with the same previously named (and
    already declared)
    function:
    btn_01.onRelease = clickHandler;
    So in AS3, you're doing the same thing:
    btn_01.addEventListener(
    MouseEvent.CLICK,
    function(evt:MouseEvent) {
    // something to do
    ... or, for more control, use a named function:
    btn_01.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(evt:MouseEvent) {
    // something to do
    See the similarities? In AS3, the event actually sends
    itself to the
    receiving function, which is where there's a parameter inside
    the function
    (I used "evt", but you can use whatever variable name makes
    sense for you).
    This parameter is typed as an instance of the MouseEvent
    class because, as
    you can imagine, it's an instance of the MouseEvent class.
    Like any other
    class, MouseEvent has properties (listed in the MouseEvent
    class), and one
    of those properties lets you refer back to the object that
    dispatched the
    event in the first place.
    It's all in there; you just have to dig a bit and see what
    your options
    are.
    Here are some links that might give you a hand:
    Colin Moock
    http://www.insideria.com/2008/01/actionscript-30-is-it-hard-or.html
    http://www.insideria.com/2008/07/the-charges-against-actionscri.html
    One of my blog entries ...
    http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
    (written for Flash CS3, but it's about AS3, so it still
    applies)
    Obviously, these Web references are free, but you might also
    get
    something out of an AS2-to-AS3 migration book I recently
    co-authored for
    O'Reilly:
    The ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    (only two Amazon reviews so far, but they're both 5 out of
    5)
    David Stiller
    Co-author, Foundation Flash CS4 for Designers
    http://tinyurl.com/5j55cv
    "Luck is the residue of good design."

  • Changing simple button color

    It would seem as if this would be simple, but I'm not finding
    any documentation.
    I have a map of the US. Each U.S. state is a simple button.
    I'd like to change the button fill color (and potentially, the
    outline color) in AS3. I've created the buttons in Flash, not in
    AS3 (just graphically). How do I change the button fill color?
    Sample code:
    function addButtonListeners(btnInstance:SimpleButton) {
    btnInstance.addEventListener( MouseEvent.ROLL_OVER,
    handleRollover);
    btnInstance.addEventListener( MouseEvent.ROLL_OUT,
    handleRollover);
    addButtonListeners(Montana);
    addButtonListeners(NewMexico);
    addButtonListeners(Washington);
    Montana._color = 0xA6CsDA; //doesn't work

    I also tried this code, but I'm getting the error message:
    Access of possibly undefined property rgb through a reference
    with static type flash.geom:ColorTransform.
    Source: color.rgb = 0x00ff00;

  • Play/Pause Button in AS3

    I have search the internet, but I cannot find a simple way to
    create a play/pause button in AS3. All the solutions I find are for
    older versions when buttons could have actionscript directly
    applied to them.
    I created a flash animation and exported it as a .swf to work
    with only one layer in a new .fla file. I have three layers
    created, button, video, and actionscript. What I need is a button
    that will look like a pause button when the animation is playing
    and to pause the animation when clicked. It would be nice if it
    could also switch to a play button when paused.

    I made a movieclip (ppBtn) with 2 frames. The first has the
    pause button and the frame label 'pause'. The second frame has the
    play button, 'play'. I placed your script into the action layer.
    When I preview the animation, the buttons just alternate really
    fast and have no fuction.

  • Creating a simple button in CS4...I'm missing something

    Okay....I'm just trying to create a simple button to test. I create a square, convert it to a button symbol. I click on the button and open the Actions window. The window says "current selection cannot have actions applied to it." Have I missed a step? I can add an action to a keyframe okay, but when I click a button, even just a simple button, it will not allow me to add an action to it?
    Anybody know what I'm missing?

    again, you cannot attach code to objects in as3.  you are going to attach code to a frame or you're going to create external as files/class files and i'm pretty sure that will be a bigger jump out of your comfort zone than attach code to a frame.
    you've already given your button an instance name (mybutton), so attached to the first frame that contains mybutton, in the actions panel paste the following:
    mybutton.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event){
    navigateToURL(new URLRequest("http://www.adobe.com"));  // better to use adobe than apple in this forum.

  • CS4- simple button Frustration?

    Hello, I just upgraded to CS4 and am finding Flash very frustrating. I only use flash for very simple ad banners. Usually have one button to click to go to a web page. Now in CS4 professional I can't do the simple of things, like create a link on a button. In the action script panel it says "Current selection cannot have actions applied to it", and the object is simply a button.
    What am I missing here? Thanks for any direction.
    sm

    If all you are doing is simple things like that, switch the publish settings to Actionscript 2.
    Actionscript 3 is a new beast of a language that doesn't necessarily lend itself well to using just a simple button action.
    If you want to use AS3, then give the button an instance name (in the properties panel when you have the object selected) and put the following code in the first keyframe.
    myButton.addEventListener(MouseEvent.CLICK,doClick);
    function doClick(evt:MouseEvent):void {
         navigateToURL(new URLRequest("http://path/to/site"));
    Replacing "myButton" with the instance name you gave your button, and the URLRequest with the web address you want to go to.

  • Simple button script not working

    I am using AS2 and need help figuring out why this simple button script is not working:
    stop();
    buttonWS1.onRelease = function(){
                        gotoAndStop("Stage1and2_Boss",4);
    buttonWS2.onRelease = function(){
                        nextFrame();
    //end
    My buttons are the square letter-puzzles below. They are images that I converted to "symbols" (specifically, buttons). I put their names as above (buttonWS1, buttonWS2, etc.) in the "instance names" boxes.
    I have no idea what is going on. Please help!

    Hi -
    1. Yes, buttonWS2 is the instance name
    2. The only code attached to it is the code I pasted above.
    3. onRelease does not execute because my trace statement does not appear in the output
    Here is the modified code for buttonWS2:
    buttonWS2.onRelease = function(){
                        trace("clicked!");
                        nextFrame();
    Question: It shouldn't matter if I have commented-out code within that set of codes should it?:
    buttonWS2.onRelease = function(){
              //if (puzzleschosenarray[0] == 2 || puzzleschosenarray[1] == 2) {
              // cannot be chosen -- make button non-functional
              //else{
                        //puzzleschosenarray[roundnumber-1] = 2;
                        trace("clicked!");
                        nextFrame();

  • Simple button to play symbol....?

    I have a symbol "NA". It is an animated map that scales up and then back in place when closed. I have added a button to the main stage to play this symbol with the following code on the "click" event:
    sym.getSymbol("NA").play();
    What am I missing? Something, because it doesn't work for some reason.
    Simple button for a simple mind?
    Any and all help would be appreciated.

    Hi OneHorse,
    I've uploaded a file showing my above code working. Instead of just using "play", I'm telling it to play from a label: play("in"). If your "NA" symbol has autoplay unchecked, there may be some weird action when you tell it just "play()".
    www.timjaramillo.com/code/edge/_source/test.zip

  • Simple button not functioning?

    I've been staring at this code for an hour. Maybe I need a break? This is a very simple button that just won't accept my touch events.
    I have a movie clip. It's instance name is "boardA." The name of the symbol is "letterA" and it is linked to a class file called "Letters" (which is properly linked, I checked).
    This is the code in the class file:
    public function Letters() {
                this.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter);
                trace (this.letter);
            public function createLetter(e:TouchEvent): void {
                trace ("You clicked it!");
                trace ("eName = " + e.target.letter);
    Yet nothing happens when I click the button. The constructor for the file never executes.
    I even moved the touch event to the main frame "boardA.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter)" and it still didn't work. Nothing when I touch the button.
    What am I missing here?
    Thanks
    Amber

    No. Letters.as is in com/freerangeeggheads/spellmaster. It's linked as such - here is the text.
    The base class is: com.freerangeeggheads.spellwhiz.Letters
    The class is: letterA
    When I click the green check box it tell me it can find the class, and when I click the edit class button it takes me to the proper script file.
    I also have the file imported into my main frame.
    This is the Letters.as file:
    package  com.freerangeeggheads.spellwhiz {
        import flash.display.*;
        import flash.events.*;
        import com.freerangeeggheads.spellwhiz.*;
        public class Letters extends MovieClip {
            public var letter:String = "";
            public function Letters(): void {
                this.addEventListener(TouchEvent.TOUCH_BEGIN, createLetter);
                trace (this.letter);
            public function createLetter(e:TouchEvent): void {
                trace ("You clicked it!");
                trace ("eName = " + e.target.letter);
    Thanks!

  • Simple Button Hit Zone not working

    I am somewhat new to Flash CS4 andt am having a problem making simple buttons in Flash CS4 on a Macintosh: I have made a few buttons with a graphic and can go into them and successfully create the Up, Over and Down stages of the graphic. Then when I create a new box for the hit state (which is larger than the graphic and I have deleted the graphic itself from the hit state) it doesn't want to appear correctly when I test the movie. When I test the movie, the hit state is correct everywhere around the graphic (to the bounds of my hit state box), but is not active where the graphic is. When I go under the Control menu, down to Enable Simple Buttons, the hit zone looks great right in my Flash file, but when I preview it or publish it and look it on different browsers (PC and Mac), I don't get my pointer right over the actual graphic, but get it everywhere around the graphic to the boundaries of my hit box. Why can't I get the actual graphic to be a hot spot in this situation? I have tried leaving the graphic in the hit timeline, and tried putting both the larger box and the graphic in the hit timeline, and still can't get them to respond correctly with the pointer in the browser window. Thank you....

    Well, since the graphic itself doesn't activate my pointer in a web browser, I thought maybe I needed to add both the box and the graphic itself to the hit state. That's what has me puzzled - the box that I use for the hit zone is "active" everywhere but where the actual graphic is...

  • Simple button problem

    I am having a real problem creating a simple button - I have
    created a Flash file using Action script 2, and when I create a
    simple button - text with a rectangle as a background, (see
    http://www.elkhavenestate.com),
    and the over state is behaving in a bizarre fashion. This is my
    first time using CS3, so is there a new control that I'm
    missing?

    I take it that it's the Home button. It appears to have a
    selectable text field or something in it, which is causing the
    problem. Either change that to a static text field or set its
    selectable property to false. The other two buttons appear to be
    fine, so maybe you can just duplicate one of them and turn it into
    the Home button.
    If I picked the wrong button, let me know.

  • Simple button help needed!

    I want to make a simple round button that glows when you
    mouse over it and depresses when you click it.
    Apparently to do this I need to use Filters to make the glow
    and bevels. But Filtersonly work on movie clips, buttons and text.
    So I make a circle and convert it into a button symbol
    (Btn1). Then I make another button symbol (Btn2) and use the first
    button symbol (Btn 1) on the Up Over and Down frames of Btn 2.
    Assorted Filters are applied to Btn 1 on the Up Over and Down
    frames to get the effects I want.
    I test the button (Btn2) using Enable Simple Buttons. It
    works perfectly - glows on mouse over and depresses on click. Then
    I try Test Movie -- and the button doesn't work!!!
    Not does it work when exported as a SWF file!!!
    I watched a tutorial video that came with my Flash Pro 8
    Hands-On-Training (HOT) book and he used pretty much the same
    technique -- except he only tested his button with Enable Simple
    Buttons. I'll bet my house his didn't work with Test Movie either!
    The stupid thing, is I was just able to achieve exactly what
    I wanted very quickly using LiveMotion 2!
    What is wrong here? Why is it so impossible to create a glow
    button in Flash? Why has it been easy in Live Motion for years?
    All help appreciated!
    Thanks
    craig

    I thought the nesting button situation might be the problem
    BUT there is no other way to apply Filters to Up, Down, etc. Also,
    a freaking tutorial book described that as a valid method, but
    obviously it ain't.
    I tried using movieclips as well but basically had the same
    problem.
    I mentioned LiveMotion 2 because that ancient program can do
    easily what Flash Pro 8 seems incapable of.
    What is the logic behind not allowing Filters to be applied
    to simple graphics? It's absurd!
    There's got to be a way...

  • Simple Button.Text not changing properly

    Hi all,
    The WPF learning curve is steep.
    I have pulled my hair over this simple Button.Text change and I can't get it to work.
    In WinForms this works:
    Public Class Form1
    Private Sub BTN_1_Click(sender As Object, e As EventArgs) Handles BTN_1.Click
    BTN_1.Text = "CLICKED BUTTON 1"
    BTN_2.Text = "CHANGED BY BUTTON 1"
    End Sub
    Private Sub BTN_2_Click(sender As Object, e As EventArgs) Handles BTN_2.Click
    BTN_2.Text = "CLICKED BUTTON 2"
    BTN_1.Text = "CHANGED BY BUTTON 2"
    End Sub
    End Class
    I want to do the same thing in WPF
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition/>
    <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0" Grid.Row="0">
    <Button Name="BTN_1" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_1_LABEL_1" Text="Button 1 text" VerticalAlignment="Top" Foreground="#BF000000" >
    </TextBlock>
    <TextBlock Name="CLICK_BTN_1_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 1</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    <Grid Grid.Column="1" Grid.Row="0">
    <Button Name="BTN_2" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_2_LABEL_1" Text="Button 2 text" VerticalAlignment="Top" Foreground="#BF000000">
    </TextBlock>
    <TextBlock Name="CLICK_BTN_2_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 2</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </Grid>
    </Window>
    Class MainWindow
    Private Sub CLICK_BTN_1(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles BTN_1.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CLICKED BUTTON 1"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CHANGED BY BUTTON 1"
    End Sub
    Private Sub CLICK_BTN_2(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles BTN_2.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CHANGED BY BUTTON 2"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CLICKED BUTTON 2"
    End Sub
    End Class
    This used to be so simple with WinForms, what am I doing wrong here?
    New to WPF

    Yeah, I saw that as well but now I am stuck again:
    Same project but I have put the buttons in a usercontrol
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Component_Changes"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition/>
    <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0" Grid.Row="0">
    <Viewbox Stretch="Fill">
    <ContentControl Name="UC_BTN1">
    <ContentControl.Content>
    <local:btn1 Margin="20"/>
    </ContentControl.Content>
    </ContentControl>
    </Viewbox>
    </Grid>
    <Grid Grid.Column="1" Grid.Row="0">
    <Viewbox Stretch="Fill">
    <ContentControl Name="UC_BTN2">
    <ContentControl.Content>
    <local:btn2 Margin="20"/>
    </ContentControl.Content>
    </ContentControl>
    </Viewbox>
    </Grid>
    </Grid>
    </Window>
    btn1.xaml
    <UserControl x:Class="btn1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
    <Button Name="BTN_1" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_1_LABEL_1" Text="Button 1 text" VerticalAlignment="Top" Foreground="#BF000000" >
    </TextBlock>
    <TextBlock Name="CLICK_BTN_1_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 1</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </UserControl>
    btn1.xaml.vb
    Public Class btn1
    Dim CL_BTN2 As btn2
    Private Sub CLICK_BTN_1(sender As Object, e As RoutedEventArgs) Handles BTN_1.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CLICKED BUTTON 1"
    ' CHANGE LABEL 1 ON BUTTON 2
    CL_BTN2.CLICK_BTN_2_LABEL_1.Text = "CHANGED BY BUTTON 1"
    End Sub
    End Class
    btn2.xaml
    <UserControl x:Class="btn2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
    <Button Name="BTN_2" Click="CLICK_BTN_2">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_2_LABEL_1" Text="Button 2 text" VerticalAlignment="Top" Foreground="#BF000000">
    </TextBlock>
    <TextBlock Name="CLICK_BTN_2_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 2</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </UserControl>
    btn2.xaml.vb
    Public Class btn2
    Dim CL_BTN1 As btn1
    Private Sub CLICK_BTN_2(sender As Object, e As RoutedEventArgs) Handles BTN_2.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CL_BTN1.CLICK_BTN_1_LABEL_1.Text = "CHANGED BY BUTTON 2"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CLICKED BUTTON 2"
    End Sub
    End Class
    No warnings in the code but the error is: 'Object reference not set to an instance of an object' and I thought I did, obviously not in the right way.
    New to WPF

  • Can't get Simple button to Load Movie Clip

    Hi I've looked around for the answer to my question on this
    forum
    but havent found it so here it goes. I am working on this
    company's
    Flash site that was built by an outside studio. I am using
    CS3.
    The url to the site is
    http://www.bubbakeg.com.
    (this link will take you to the main page click the shadow
    graphic
    on the left under Bubba and this will take you to the site I
    am speaking
    of. The site is basically 5 different pages or movie clip.
    What I am
    trying to do is basically change the "Spring Break" middle
    graphic
    (which is a Movie Clip) on the HOME page and add a simple
    button
    that will direct the user to a new page. When I replaced the
    graphic
    with a new Movie clip there was no problem but I have added
    a
    button to load a new page (movie clip) and nothing happens.
    This
    button is in the movie clip of the new graphic which is
    called up
    when the page loads. If i take this button and just put it
    on the
    Main Stage in Scene 1 by itself it works and loads the page
    (movie clip). It does not however when it is embeded in the
    Movie
    Clip. The Flash site is basically 5 different Movie Clips
    loaded into
    an "Empty Clip". This empty clip has a timeline with each of
    the
    clips labeled and with their respective sized placeholders.
    And
    when you click on either the links on the Nav bar or the
    graphic
    for each page it loads that movie clip on the main page. It
    seems
    like the button only wants to work on the main timeline. I
    have
    even replaced the code for the "Contact" button with the code
    for the new button and it worked (opening new page). Here is
    the
    code for the new button that does not work:
    on (release) {
    _root.contentHolder.myHeight = 307;
    _root.contentHolder.newLoc = 9;
    heightAnimation();
    I know the location and height from the above code are
    referring to the placement and sizing of each movie clip
    in the "Empty Clip". As i said before this heightAnimation
    and the resizing of the new clip works fine when the
    button resides in Scene 1 on the Main Timeline but not
    within the new movie clip (graphic Ive created.)
    I will upload the main chunk of the code that resides
    in Scene 1 on the first frame of the "Actions" layer.
    If anyone has any ideas I would appreciate it very much!
    Please let me know if I can provide anymore info.
    Thanks!
    Greg

    change:
    function newLayerBT_CLICK(MouseEvent):void{
    to:
    function newLayerBT_CLICK(e:MouseEvent):void{

Maybe you are looking for

  • Error when downloading iTunes.

    I haven't synced my ipod classic in a while so I went to plug it in and nothing happened. I then discoved iTunes was not even installed on my computer anymore. So, I went to apple.com, itunes, download, all of that... it was working and showed all si

  • Sender File Adapter

    Hi Guys, I have a requirements wherein I have to pick up .xml and .tif files from one folderusing NFS.  The tif file to be picked up should correspond to the filename of the .xml.  Could anyone help me on how to acheive this? Below is currently the c

  • Created invalid WSDL with the Integration Builder Wizard

    Hello altogether, I'm sitting on a WSDL to Proxy scenario and therefore I created a WSDL file with the help of the Integration builder wizard and the how to guide. I created the URL after the standard scheme: http://<host>:<j2ee-port>/XISOAPAdapter/M

  • Drag and drop an Address Book card onto a Pages address field

    Whenever I "drag and drop" an Address Book card onto a Pages address field, it hangs for almost a minute before the address appears. I don't believe this is normal, does anyone else have this problem?

  • SUS ASN for changed delivery date

    We are on SRM 7.0 EHP4 with MM-SUS. PO is been sent to SUS with Required on date 02/03/2011. Supplier confirms for 02/04/2011. Now the system doesn't allow the supplier to create ASN in SUS. The SUS system is waiting for a change order from Buyer to