Simple Button Target Question
Just wondering...
Say I have a button that leads to menu 2... what is the general usage pattern? do you generally set you button to go to another button on menu 2, or is common practice simply to go to [Menu] target of menu 2? If not to the [Menu] target, why to a button?
Thanks yet again...
If you do not set a button as target, then it goes to the default button on the menu, which may get switched depending on where the buttons are and how you moved the buttons. It is a question of your navigation scheme that you want. I usually target a button as a matter of course and check all navigation also for where I want things to go/behave.
Similar Messages
-
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 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
AmberNo. 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! -
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!
Gregchange:
function newLayerBT_CLICK(MouseEvent):void{
to:
function newLayerBT_CLICK(e:MouseEvent):void{ -
Is there one simple button or option called "delete or remove duplicates" ??
is there one simple button or option called "delete or remove duplicates" ??
to clarify..in winamp you simply click remove duplicates and all duplicate songs are removed. In Itunes it appears you have to click on each individuale song. (yes you can hold the control key and hit delete one time , but when yo uhave hundreds or thousands of songs this is very time consuming
Surely there must be a faster simpler way??????
Message was edited by: IanLeg
NO THIS DIDS NOT SOLVE ANYTHING i'M ADDING TO MY ORIGINAL QUESTION. I DID NOT SAY IT SOLVED IT
THE ITUNES APPLE CRAP IS REDICULOUS -
Changing stroke color of simple button
How do you change the stroke color of a simple button? I have
50 simple buttons representing the 50 U.S. states. When I change
the fill color with the following algorithm, I also eradicate the
outline (stroke) color. How do I code in a stroke color?Unfortunately I think you can't use SimpleButtons for this.
ColorTransform adjusts the color of the entire object as you found
out. To adjust just the color of a fill object, you would have to
separate out the fill and stroke into two objects inside the
button, then make the fill a MovieClip and give it an instance
name, say "fill", and target it that way:
var t = new ColorTransform();
t.color = 0xb43030;
btn.fill.transform.colorTransform = t;
Unfortunately, SimpleButton is not a DisplayObjectContainer
so I don't think you can have it contain any MovieClips, such as
fill. You will have to change all your buttons to MovieClips first. -
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 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...
-
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
craigI 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... -
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 muchMy 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? -
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 WPFYeah, 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 -
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 workI 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; -
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 -
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.
Maybe you are looking for
-
Why Define WebService system occur error in VC7.0?
i used SDN How-to document <Creation of VC Model Using Exchange Rate Web Service>. iVC7.0>tools->define web services), i use webservices URL :http://www.webservicex.net/CurrencyConvertor.asmx/WSDL but VC7.0 System display Failure. error info: Invalid
-
ICal and iClock unusual performance
I have aligned this question with the nearest subject I can find. I recently purchased and installed 10.4.3 and upgrades to 10.4.5. Generally all went well but I noticed the time top r.h.corner was an hour slow (behind). I clicked on the date and at
-
EOIO - Could not fail message - Predecessor not in final state
Hi, I'm using the File Adapter to send messages EOIO and have now a lot of messages stuck with status "HOLDING". When trying to delete the first message with status holding (according to sequential number in the message monitor log) I get the error:
-
Can I still sign a document after I certify it first?
1.I certify a pdf document first ,and I choose the permission as "form fill-in and digital signature" 2.But when I want to add digital signature to sign the document , the "Place a digital signature" is disable both in menu and toolbar :( so ,who can
-
Cann't change quantity in the Inbound delivery
Hello buddies, I have a situation wherein the client created inbound delivery, posted GR, then reversed 2 materals. After that he tried to reduse delivery quantity for those materials, but the error message "Picked quantity is larger than the quanti