Be a Supporter!

Layer

  • 302 Views
  • 8 Replies
New Topic Respond to this Topic
xtended12
xtended12
  • Member since: Apr. 12, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Layer 2009-05-20 11:18:27 Reply

Hi everyone! I have a question :
----------------------------------------
----

How I can make a button that locks layer when movie is playing and turn invisible. Like in other movies has a subtitles and a button that turn on or turn off...


Power is everything...

Kirk-Cocaine
Kirk-Cocaine
  • Member since: Aug. 17, 2003
  • Offline.
Forum Stats
Moderator
Level 38
Programmer
Response to Layer 2009-05-20 11:26:06 Reply

At 5/20/09 11:18 AM, xtended12 wrote: How I can make a button that locks layer when movie is playing and turn invisible. Like in other movies has a subtitles and a button that turn on or turn off...

The movies aren't turning on and off the layer, they're just changing the visibility of the items on that layer.

//AS2
mySubtitles._visible = false;

//AS3
mySubtitles.visible = false;

etc


The water in Majorca don't taste like what it oughta.

| AS3: Main | AS2: Main | Flash Tutorials |

BBS Signature
dragonjet
dragonjet
  • Member since: Dec. 2, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to Layer 2009-05-20 11:27:41 Reply

you don't call it lock, but visibility.
you do that by actionscript using the property

<em>movieClip</em>._visible=<em>booelanValue</em>;

my another advice is that you don't turn on/off the subtitles itself,
but the mask that lets you see it.
(definitely mask is another layer)

dragonjet
dragonjet
  • Member since: Dec. 2, 2005
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to Layer 2009-05-20 11:28:50 Reply

At 5/20/09 11:27 AM, dragonjet wrote: you don't call it lock, but visibility.
you do that by actionscript using the property
movieClip._visible=booelanValue;
my another advice is that you don't turn on/off the subtitles itself,
but the mask that lets you see it.
(definitely mask is another layer)
movieClip._visible=booelanValue;

oh so Italic doesn't work inside code tags?

xtended12
xtended12
  • Member since: Apr. 12, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Layer 2009-05-20 11:30:05 Reply

So that code with " mySubtitles " I need to name that layer or just instant name..?


Power is everything...

Kirk-Cocaine
Kirk-Cocaine
  • Member since: Aug. 17, 2003
  • Offline.
Forum Stats
Moderator
Level 38
Programmer
Response to Layer 2009-05-20 11:33:56 Reply

At 5/20/09 11:28 AM, dragonjet wrote: oh so Italic doesn't work inside code tags?

Clearly not, as the <code> tags prevent any sort of auto formatting of tags. It'd be pretty rubbish if you wrote out some HTML in code tags, only for it to be all formated when you posted. ;)

At 5/20/09 11:30 AM, xtended12 wrote: So that code with " mySubtitles " I need to name that layer or just instant name..?

Needs to be the instance name. Layers names are only used when you're working in Flash, you can't refer to layers through AS in your exported SWF or anything.


The water in Majorca don't taste like what it oughta.

| AS3: Main | AS2: Main | Flash Tutorials |

BBS Signature
xtended12
xtended12
  • Member since: Apr. 12, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Layer 2009-05-20 11:43:56 Reply

So Create movie clip<give instant name<write that code IN BUTTON<and done?


Power is everything...

Kirk-Cocaine
Kirk-Cocaine
  • Member since: Aug. 17, 2003
  • Offline.
Forum Stats
Moderator
Level 38
Programmer
Response to Layer 2009-05-20 12:21:37 Reply

At 5/20/09 11:43 AM, xtended12 wrote: So Create movie clip<give instant name<write that code IN BUTTON<and done?

You can't just paste that code as is into a button, you'll need to give it some sort event.

//AS2
myBTN.onPress = function(){
	//Visible code here
}



//AS3
myBTN.addEventListener(MouseEvent.CLICK, clicked);
function clicked (e:MouseEvent):void{
		//Visible code here
}

Where myBTN is the instance name of your button. Both sets of code live on the main timeline.


The water in Majorca don't taste like what it oughta.

| AS3: Main | AS2: Main | Flash Tutorials |

BBS Signature
xtended12
xtended12
  • Member since: Apr. 12, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Layer 2009-05-20 13:17:20 Reply

Thanks man!


Power is everything...