Zurück   Flashforum > Flash > Flash Einsteiger

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 30-12-2008, 18:40   #1 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Question How do I create an "Alternate text" on a button in Adobe Flash CS4?

Hello,

I'm new to this but luckily got quite far in creating my first flash website. I noticed that there is somewhere a section for writing code (Actionscript 2 /3?), but it is difficult to find. I dont even know if it is necessary go into the code editor to add an alternate text for a normal jpg-image.

Could someone tell me how to add this alternate text on mouse roll-over to appear when placing it over the image and are there ways of changing the style, for making the text that pops up larger?

Thanks, Burton
raefe ist offline   Mit Zitat antworten
Alt 30-12-2008, 18:52   #2 (permalink)
Perverted Hermit
 
Benutzerbild von Omega Psi
 
Registriert seit: Mar 2004
Ort: Delmenhorst
Beiträge: 12.142
Whenever you want to add some sort of interaction you need to add at least some lines of actionscript.

What you need is some knowledge about the eventsystem. Since i don't know which components you use i'll write down some line of code which you just have to modify:
ActionScript:
  1. var button:MovieClip = new MovieClip();
  2. button.addEventListener(MouseEvent.MOUSE_OUT, mouseEventListener);
  3. button.addEventListener(MouseEvent.MOUSE_OVER, mouseEventListener);
  4. button.label = "out";
  5. addChild(button);
  6.  
  7. function mouseEventListener(event:MouseEvent):void
  8. {
  9.     switch(event.type)
  10.     {
  11.         case MouseEvent.MOUSE_OUT:
  12.             MovieClip(event.target).label = "out";
  13.             break;
  14.         case MouseEvent.MOUSE_OVER:
  15.             MovieClip(event.target).label = "over";
  16.             break;
  17.     }
  18. }
What this tiny script does:
Creating a MovieClip instance and adding eventlisteners as well as a field label. Whenever a MouseEvent is dispatached by the MovieClip instance, the listener will be invoked.
Omega Psi ist offline   Mit Zitat antworten
Alt 30-12-2008, 22:22   #3 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Thank you, but I am completely new to this. Could you please tell me more precisely how to proceed and where I can find the editor for this?

What kind of component do you need to know? I just have four images that I use as nagivation menu buttons, which I modified from previous template at the top of the page. I have them saved in the library.

And your whole actionscript is necessary just for having the text pop up once the mouse is moved over the picture? Seems a big deal for such a small thing... is there no easier standard option to do this?

Many thanks.
raefe ist offline   Mit Zitat antworten
Alt 30-12-2008, 23:43   #4 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
Zitat:
Zitat von raefe Beitrag anzeigen
Thank you, but I am completely new to this.
So have you ever considered learning the very basics for yourself and then consulting a forum in case you encounter a specific issue or problem..?
Please be aware that a forum is not a good place to start if you have no idea or no plan and a forum cannot replace books, lessons, tutorials, practice and so on.
Btw, what you are looking for is called 'tooltip'.
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 31-12-2008, 00:26   #5 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Thanks , but no I do not intend to learn it all as I am only doing one site and it is 90% complete thanks to the template. It would be too timeconsuming to learn it from scratch....

Anyhow, I found the editor under: Windows --> Actions (or F9)
And thanks for the tooltips, I'll watch this video tomorrow:
http://library.creativecow.net/artic...e/tooltips.php

Cheers!
raefe ist offline   Mit Zitat antworten
Alt 31-12-2008, 12:32   #6 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Why did you not allow my last posting ??

That was a clearly helpful posing with example and a reply to Omega !?

Geändert von raefe (31-12-2008 um 12:34 Uhr)
raefe ist offline   Mit Zitat antworten
Alt 31-12-2008, 12:35   #7 (permalink)
Flashworker
 
Benutzerbild von sebastian
 
Registriert seit: Nov 2001
Ort: Wiesbaden
Beiträge: 10.945
Zitat:
Zitat von raefe Beitrag anzeigen
Why are you no longer allowing my postings !!??
The first ten posts of each user will be checked for spam.
Now your post is visible
sebastian ist offline   Mit Zitat antworten
Alt 01-01-2009, 02:25   #8 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Ich deute nochmals drauf, das hier ist das "Flash Einsteiger" forum
Mit dem tooltip funktionierts noch nicht richtig, das tooltip-Bild erscheint nicht wenn ich mit dem Maus über den button (bzw. jpg-image) gehe. Hier der code:
Code:
tooltip._visible = false

var tipInt;

b1.onRollOver = function() {
	tipInt = setInterval(showTip,100,"Ausstellungen");
}

b1.onRollOut = function() {
	hideTip();
}

b2.onRollOver = function() {
	tipInt = setInterval(showTip,100,"Lieferanten");
}

b2.onRollOut = function() {
	hideTip();
}

b3.onRollOver = function() {
	tipInt = setInterval(showTip,100,"Kunden");
}

b3.onRollOut = function() {
	hideTip();
}

b4.onRollOver = function() {
	tipInt = setInterval(showTip,100,"Kontakt");
}

b4.onRollOut = function() {
	hideTip();
}

var count = 0;

function showTip(tiptext) {
	if(count == 1) {
		clearInterval(tipInt);
		count = 0;
		tooltip.tiptext.text = tiptext;
		tooltip._x = _root.xmouse;
		tooltip._y = _root.ymouse;
		tooltip._visible = true;
		_root.OnMouseMove = function() {
			tooltip._x = _root.xmouse;
			tooltip._y = _root.ymouse;
			updateAfterEvent();
		}
	}
	
	else {
		count++;
	}
}

function hideTip() {
	clearInterval(tipInt);
	tooltip._visible = false;
}
Ich hatte diesen code im timeline "actions" hinzugefügt, evtl. klappte es nicht weil code bereits vorhanden war. Also habe ich diesen code im leeren "tooltip" timeline oberhalb 'actions' eingefügt, ebenfalls ohne Erfolg (ich denke es müsste schon in "actions" sein).
Das einzige mal das er erscheint ist ganz kurz beim Aufbau der Seite, dann kommt er nicht mehr. Unter actions frame "check syntax" findet er keine Fehler. Wie füge ich den tooltip code korrekt ein?

In actions habe ich folgende timelines:
Actions frame 1 (buttons, labels)
Code:
music_notes.setMask(music_notes_mask);
menu_item_group.menu_item._visible = false;
var menu_label:Array = new Array("", "", "", "", "");
var total:Number = menu_label.length;
var distance_x:Number = 124;
var i:Number = 0;


for( ; i < total; i++ )
{
	menu_item_group.menu_item.duplicateMovieClip("menu_item"+i, i);
	menu_item_group["menu_item"+i].over = true;
	menu_item_group["menu_item"+i].item_label = menu_label[i];
	menu_item_group["menu_item"+i].item_no = i;
	menu_item_group["menu_item"+i]._x = i * distance_x;
}
function change_page(no):Void
{
	for( i = 0; i < total; i++ )
	{
		menu_item_group["menu_item"+i].flashmo_button._visible = true;
		menu_item_group["menu_item"+i].over = true;
		menu_item_group["menu_item"+i].flashmo_button.onRollOver = function() 
		{
			this._parent.over = false;
		}
		menu_item_group["menu_item"+i].flashmo_button.onRollOut = 
		menu_item_group["menu_item"+i].flashmo_button.onDragOut = function() 
		{
			this._parent.over = true;
		}
		menu_item_group["menu_item"+i].flashmo_button.onRelease = function() 
		{
			_root.change_page(this._parent.item_no);
		}
		menu_item_group["menu_item"+i].onEnterFrame = function() 
		{
			if( this.over == true ) this.prevFrame();
			else this.nextFrame();
		}
	}
	delete menu_item_group["menu_item"+no].flashmo_button.onRollOut;
	menu_item_group["menu_item"+no].flashmo_button._visible = false;
	menu_item_group["menu_item"+no].over = false;
	_root.page = no + 1;
	_root.play();
}
change_page(0); // the default page on load

flashmo_floral.onEnterFrame = function()
{
	speed = ( 400 + _xmouse - this._x) * 0.004;
	this._rotation += speed;
	flashmo_plant._x += speed;
	
	if( this._rotation > 150 )
		this._rotation = 150;
	if( this._rotation < -150 )
		this._rotation = -150;
	
	if( flashmo_plant._x > 700 )
		flashmo_plant._x = 700;
	if( flashmo_plant._x < 400 )
		flashmo_plant._x = 400;
}
Actions: frame 15 (start)
Code:
flashmo_contents.gotoAndStop(page);
Actions: frame 30
Code:
flashmo_contents.gotoAndStop(page);
stop();
Actions: frame 46
Code:
gotoAndPlay("start");
Die JPG-s habe ich nach 'b1' usw. umbenannt und Eigenschaften des movieclips nach 'tooltip' umbenannt.

Geändert von raefe (01-01-2009 um 02:30 Uhr)
raefe ist offline   Mit Zitat antworten
Alt 02-01-2009, 11:34   #9 (permalink)
Neuer User
 
Registriert seit: Dec 2008
Beiträge: 6
Ich bräuchte immer noch Hilfe hierzu / I still need help for this.

Thanks!
raefe ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 23:42 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele