Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Yet another thing in Flash I can't get right -_-

New Here ,
Jan 27, 2013 Jan 27, 2013

I made a button called 'Hardcore' with an instance name of 'Hardcore'.

It is a red-button with white text that says 'Hardcore'. On 'Over' I made the text blue.

On 'Down' I made the text green. And on Hit I made the text white, and the button blue instead of red.

However when I test-it (CTRL+ENTER) the Hit part never works/runs. When I let go of my mouse-click, it instead goes to

the part under 'Over' (Blue text Red button). Anything I'm doing wrong? o.o

TOPICS
ActionScript
5.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 27, 2013 Jan 27, 2013

the hit frame of a button is never displayed.  it determines the region where the mouse triggers the over and down frames.

Translate
Community Expert ,
Jan 27, 2013 Jan 27, 2013

the hit frame of a button is never displayed.  it determines the region where the mouse triggers the over and down frames.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

That sucks. Meh. Thanks :I

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

When I apply the StopAllSounds() [or whatever it was] it says I need an event-handler?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2013 Jan 27, 2013

you're trying to attach that code to an object.

remove the code, click an empty part of the stage and add the code to the actions panel.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

Oh right. I'll try it...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

Alright. I'm using that old invisible code you gave me. Welp, clicking on the Button 'Hardcore' succesfully makes the MovieClip 'DubstepInfo' invisible. However, clicking on the button 'Dubstep' does NOT make MovieClip 'DubstepInfo' become visible. I even put them on the frames, not the objects. Heh. Anything to say? :I

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2013 Jan 27, 2013

var s:Sound=new Sound();

s.attachSound("Dubstep1");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep1.onRelease=function(){

stopAllSounds();

s.start();

}

var s:Sound=new Sound();

s.attachSound("Dubstep2");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep2.onRelease=function(){

stopAllSounds();

s.start();

}

Using this, I can successfully make it so pressing one button quits out all the rest, but for-some reason, they both play Dubstep2.wav. I used Linkage for the songs, and the buttons's names, and instance names are Dubstep#.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2013 Jan 28, 2013

use:

var s1:Sound=new Sound();

s1.attachSound("Dubstep1");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep1.onRelease=function(){

stopAllSounds();

s1.start();

}

var s2:Sound=new Sound();

s2.attachSound("Dubstep2");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep2.onRelease=function(){

stopAllSounds();

s2.start();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

Yes thank you! Along with the song you pick it changes the name of the text:

Artist: x

Track: y

Do I use the invisible-code or is there some special value for this?

THANK THANK THANK THANK THANK YOU FOR THAT LAST CODE

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2013 Jan 28, 2013

you can add a dynamic textfield to your stage, assign it an instance name (eg, tf) and then assign its text in your onRelease functions:

var s1:Sound=new Sound();

s1.attachSound("Dubstep1");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep1.onRelease=function(){

stopAllSounds();

s1.start();

tf.text="artist: x1, track: y1";

}

var s2:Sound=new Sound();

s2.attachSound("Dubstep2");  // you need to assign this linkage id to the sound that should play onRelease

Dubstep2.onRelease=function(){

stopAllSounds();

s2.start();

tf.text="artist: x2, track: y2";

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

**Error** Symbol=DubstepInfo, layer=Layer 1, frame=1:Line 6: String literal was not properly terminated

     DubstepText.text="Artist: Skrillex,

**Error** Symbol=DubstepInfo, layer=Layer 1, frame=1:Line 7: Syntax error.

     Track: First Of The Year";

**Error** Symbol=DubstepInfo, layer=Layer 1, frame=1:Line 16: String literal was not properly terminated

     DubstepText.text="Artist: The Living Tombstone,

**Error** Symbol=DubstepInfo, layer=Layer 1, frame=1:Line 17: Syntax error.

     Track: First Of The Year";

Total ActionScript Errors: 4            Reported Errors: 4

Is there any way I can make the font and stuff stay the same?

And I also need to make the Artist part on top of the Track part

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2013 Jan 28, 2013

you can't use this:

DubstepText.text="Artist: Skrillex,

      Track: First Of The Year";

use:

DubstepText.text="Artist: Skrillex,\nTrack: First Of The Year";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

Alright I'll try. Stay tuned.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

Thank you so much!

But how can I make the MovieClip 'DubstepInfo' invisible from the start

and clicking the Button 'Dubstep' (Symbol and Instance name being 'Dubstep') makes the movieclip

with all the buttons and text appear? I tried using the invisible code but it wouldn't really work out.

Also, the loop-code worked. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2013 Jan 28, 2013

no, 99 is not the max. 

there is a max but i don't know what it is.  you could experiment if you have a short sound and enough time.

DubstepInfo._visible=false;

Dubstep.onRelease=function(){

DupstepInfo._visible=true;  // <- i'm not sure this is the movieclip you want to make visible when Dubstep is clicked.

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

Stay tuned, firing up Flash

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

**Error** Scene=Scene 1, layer=Text, frame=377:Line 1: Statement must appear within on/onClipEvent handler

     DubstepInfo._visible=false;

**Error** Scene=Scene 1, layer=Text, frame=377:Line 2: Statement must appear within on/onClipEvent handler

     Dubstep.onRelease=function(){

Total ActionScript Errors: 2            Reported Errors: 2

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2013 Jan 28, 2013

I accidentally put it on the MovieClip.

So I removed it from the object, and placed this:

DubstepInfo._visible=false;

Dubstep.onRelease=function(){

DupstepInfo._visible=true;  // <- i'm not sure this is the movieclip you want to make visible when Dubstep is clicked.

}

On both the Layer keframe that has Button 'Dubstep' and the seperate Layer with the keyframe that has MovieClip 'DubstepInfo'

I made it so it's invisible from the start, but I can't make it visible later on

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

by "it", do you mean DupstepInfo?

if yes, are you clicking Dupstep and failing to see DupstepInfo?

if yes, add the following trace to confirm you are clicking Dupstep:

DubstepInfo._visible=false;

Dubstep.onRelease=function(){

trace(DupstepInfo);

DupstepInfo._visible=true;  // <- i'm not sure this is the movieclip you want to make visible when Dubstep is clicked.

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Nope, didn't work.

This is what they look-like:

http://s13.postimage.org/3jwvhpxuf/dub.gif

I still don't know what trace is supposed to do, it never works. In case it helps, for whatever reason, I'm using Macromedia Pro 8.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

if you fail to see trace output, you either don't have a button named Dubstep when that code executes or you do and you're not clicking it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Fine I'll delete it, and make a new button. Also, how can I make it so clicking the button (hit) makes it a different color. So clicking a blue button will make it Light blue until another is pressed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

that can't be done with simple buttons. you have to use movieclip buttons to do that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Eh, ok. Stay tuned.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines