Jump to content

Adaugare Link Intr-Un Template Flash


InFo

Recommended Posts

Uite codurile template :


// C o p y r i g h t   ©   p l a y c s . r o

// D e v e l o p e d   b y   M i n  T h u


// Tweener

// http://code.google.com/p/tweener/

import caurina.transitions.Tweener;


// To make a link to an external page, write label as "Label|URL" in array value

// EXAMPLE 1: "Flash Templates|http://www.playcs.ro/forum/"

// EXAMPLE 2: "Donate|http://www.playcs.ro/forum/"


var menu_label:Array = new Array("Home", "Forum", "Host", 

								 "Regulament", "Dropuri", "Contact");


var total:Number = menu_label.length;

var i:Number = 0;

var page:Number;

var main_menu:MovieClip = new MovieClip();

stage.addChild(main_menu);


fm_button.visible = false;

stop();


for (i = 0; i < total; i++)

{

	var btn = new flashmo_button();

	btn.name = "btn" + i;

	btn.x = fm_button.x + i * ( fm_button.width + 12 );

	btn.y = -50;

	btn.buttonMode = true;

	btn.item_no = i;

	btn.flashmo_click_area.addEventListener( Event.ENTER_FRAME, btn_enter );


	var each_substring:Array = menu_label[i].split("|");

	btn.flashmo_button_label.fm_label.text = each_substring[0];

	btn.item_url = each_substring[1];

	main_menu.addChild(btn);


	Tweener.addTween( btn, { y: fm_button.y, time: 0.6, 

					 delay: 0.2 * i, transition: "easeOutQuart",

					 onComplete: goto_page, onCompleteParams:[i] } );

}


function goto_page(no:Number):void

{

	if( no == main_menu.numChildren - 1 )

		change_page(0);	// default page on load

}


function btn_over(e:MouseEvent):void

{

	e.target.parent.over = true;

}


function btn_out(e:MouseEvent):void

{

	e.target.parent.over = false;

}


function btn_click(e:MouseEvent):void

{

	var mc = e.target.parent;

	if ( mc.item_url != undefined )

		navigateToURL( new URLRequest( mc.item_url ), "_parent" );

	else

		change_page(mc.item_no);

}


function btn_enter(e:Event):void

{

	var mc = e.target.parent;

	if ( mc.over == true )

		mc.nextFrame();

	else

		mc.prevFrame();

}


function change_page(no:Number):void

{

	for (var i:Number = 0; i < main_menu.numChildren; i++)

	{

		var mc = MovieClip( main_menu.getChildAt(i) );

		mc.over = false;

		mc.flashmo_click_area.visible = true;

		mc.flashmo_click_area.addEventListener( MouseEvent.ROLL_OVER, btn_over );

		mc.flashmo_click_area.addEventListener( MouseEvent.ROLL_OUT, btn_out );

		mc.flashmo_click_area.addEventListener( MouseEvent.CLICK, btn_click );

	}

	var mc_selected = MovieClip( main_menu.getChildAt(no) );

	mc_selected.over = true;

	mc_selected.flashmo_click_area.visible = false;

	mc_selected.flashmo_click_area.removeEventListener( MouseEvent.ROLL_OVER, btn_over );

	mc_selected.flashmo_click_area.removeEventListener( MouseEvent.ROLL_OUT, btn_out );

	mc_selected.flashmo_click_area.removeEventListener( MouseEvent.CLICK, btn_click );


	page = no + 11;

	play();

}


flashmo_credit.addEventListener( MouseEvent.CLICK, goto_fm );


function goto_fm(e:MouseEvent):void

{

	navigateToURL( new URLRequest( "http://www.playcs.ro" ), "_parent" );

}


/*

var default_volume:Number = 0.50; // 0.00 to 1.00

var bg_music:Sound = new flashmo_music();

var music_channel:SoundChannel = bg_music.play(0, 10000);

var music_volume:SoundTransform = new SoundTransform();


music_volume.volume = default_volume;

music_channel.soundTransform = music_volume;


sound_control.stop();

sound_control.addEventListener( MouseEvent.CLICK, play_pause );


function play_pause(e:MouseEvent):void

{

	music_volume.volume = default_volume;


	if( e.target.currentFrame == 1 )

	music_volume.volume = 0;


	music_channel.soundTransform = music_volume;

	e.target.play();

}

*/ 

PS: Cu , cod HTML nu merge , am incercat toate codurile :)) .

Link to comment
Share on other sites

Codul e deja scris acolo. Nu inteleg de ce vrei tema flash...

Iti pot recomanda programul Sothink swf quicker (cu care am lucrat eu in trecut), si cu care vei putea adauga link babeste (selectezi portiunea pe care vrei link, introduci adresa, si ai terminat).

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Link to comment
Share on other sites

Nu stiu ce nu intelegi. Codul actionscript pentru adaugarea unui link este de forma:

this.onMouseUp = function() {

    getURL("http://url", "_blank");   (target "blank" pentru a deschide intr-o pagina noua)

};
Sau pentru actionscript 3.0:
movieClipName.addEventListener(MouseEvent.CLICK, callLink);

function callLink:void {

  var url:String = "http://url";

  var request:URLRequest = new URLRequest(url);

  try {

    navigateToURL(request, '_blank');

  } catch (e:Error) {

    trace("Error occurred!");

  }

}

Partea cu try/catch este optionala si se refera la exceptii soft. Nu ai nevoie de ele in cazul tau.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.