Button roll-over animation with dynamic text
So I have a button I want to be able to use over and over. When you roll over the button, it does an animation and has a dynamic text box in it. Ovbiously im trying to make each text different for each button. What would be the smartest way to go about this? Thanks,
Dan
create a movieclip, put a stop() in frame one and add your "up" graphics, textfield etc put everything in its own layer. create another keyframe on that timeline and label the frame "over" and add new keyframes only on the layers that will change. ie, if the textfield doesn't change, don't put a keyframe on its layer. likewise, for a "down" frame, if you want one.
use instance names for everything in the movieclip that you want to control with actionscript. ie, your textfield(s) will need instance name(s). i usually use one textfield named tf.
then use:
btn1.tf.text = "test"
btn1.addEventListener(MouseEvent.ROLL_OVER,overF);
btn1.addEventListener(MouseEvent.ROLL_OUT,outF);
btn1.addEventListener(MouseEvent.MOUSE_DOWN,downF);
function overF(e:Event){
// if you have another textfield here assign its text
// likewise for other objects you want to change
e.currentTarget.gotoAndStop("over");
function outF(e:Event){
// if you changed textfields in the other frames, reassign tf.text here
e.currentTarget.gotoAndStop(1);
function downF(e:Event){
// if you have another textfield here assign its text
e.currentTarget.gotoAndStop("down");
Similar Messages
-
Much of my text looks fuzzy until I roll over it with my mouse
much of the text looks out of focus until i roll over it with my mouse, then it is clearly readable
This usually occurs because you're printing a photo in an Aspect Ratio different from the actual shot. The Aspect Ratio is the shape of the photo, expressed as the length x breadth.
So, if you have - for instance - a 4:3 shot and try print that at 4:6 you will have issues. -
Help with dynamic text and and css !
My second question of the day.
I'm trying to build a feature in my app in which the user can
hide/reveal
bolding and or
italics and or
underlining. The text is being loaded in from an xml file
and I was thinking about styling it with css in order to get the
underlining. My problem is that the only way I can think about
pulling this off is to have a css style sheet that has a defined
bold,italic and underline class defined- - then another one that
just has a italic and underline class defined -- then another one
that has just a bold and underline class defined . . . and so on
and so on. You can see why I would prefer a much more streamlined
system. Unfortunately my experience with dynamic text styling is
somewhat limited. Hopefully someone can help me out here.Perfect. I knew it was some little snippet that I was
forgetting. I made a temporary fix of creating a 0% alpha box over
the button like a fake click area above the text, and that worked
but I know that it was a half-arsed way of working around it.
Thanks. -
A drag and drop game with dynamic text response
Hi,
I am a teacher and my school has recently upgraded to Adobe Design Premium. Our previous version was about 5 versions out of date.
I teach A Level which requires students to create an Interactice Multimedia product.
In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
I use a switch case statement which I have copied below to make the drag and drop work. The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
on(press) {
startdrag(this);
on(release) {
stopdrag();
switch(this._droptarget) {
case "/dropzoneB":
_root.answer="Well done";
break;
case "/dropzoneA":
case "/dropzoneC":
_root.answer="Hopeless";
break;
default:
_root.answer="";
break;
Any help would be much apeciated.
Thanks
AdrianTo drag in as3
blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
// Register mouse event functions
blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
// Define a mouse down handler (user is dragging)
function mouseDownHandler(evt:MouseEvent):void {
var object = evt.target;
// we should limit dragging to the area inside the canvas
object.startDrag();
function mouseUpHandler(evt:MouseEvent):void {
var obj = evt.target;
obj.stopDrag();
if you want to make the text do what you want then something like this might work.
In the function, you could add a text box onto the stage, give it a instance of something like outputText
and then:
outputText = ("Bla Bla Bla");
(^Not sure if this will work exactly^)
PS. I am currently a A-level student -
Cannot use text:TextField with dynamic text in 3.2
Hi,<br /><br />I have a multi-lang app which uses English LTR and Hebrew-Arabic RTL.<br />I am using a properties file for each language, and I get the<br />right item using resourceManager getString.<br /><br />Until 3.2 I had to reverse the order of the words in each item when using<br />Hebrew (or Arabic for that matter).<br /><br />In 3.2 with the new Text layout framework, this is not needed (MAJOR IMPROVEMENT) but I cannot get it to work with dynamic text only static text.<br /><br />of course all works great if I upgarde to flex 4.0, and use the textBox component, but I do not want to do that, so late in the development phase of the application.<br /><br />Here is a small mxml which shows the problem:<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"<br /> xmlns:TryComps="appComponents.*" xmlns:text="flash.text.*"><br /> <mx:Style source="css/flashTypeStyles.css"/> <br /> <mx:Script><br /> <br /> import mx.resources.ResourceManager;<br /> <br /> </mx:Script><br /> <mx:Label text="Using text:TextField FIXED : THIS WORKS"/><br /> <!-- some text in hebrew if you dont see it you probably dont have it insalled --><br /> <text:TextField text="עברית כותבים מימין לשמאל"/><br /> <mx:Label text="Using text:TextField DYNAMIC : THIS DOES NOT WORK"/><br /> <text:TextField text="{resourceManager.getString(Locales.LOCALE_BUNDLE,'BI_DIRECTIONAL_TEXT')}"/><br /> <br /></mx:Application><br /><br />Any one has an idea ???<br />The 'BI_DIRECTIONAL_TEXT' is an entry in the property file which has the same value as the static text above.<br /><br />The run time error I get is : <br />TypeError: Error #2007: Parameter text must be non-null.<br /><br />Thanks<br /><br />Eli7
If you look thru the TextField class in the help documents you will find all of the properties you can manipulate. One property is the wordWrap property which will keep you text from going off the side of the textfield. Another is multiline which will allow the textfield to have more than one line. And another is the autoSize property which will make your textfield adjust to fit the amount of text loaded into it.
-
Do we get roll over minutes with...
Do we get roll over minutes with with the iPhone plan? If so I don't need the $79.95 plan..hehe.
Check AT&T's fine print, and don't get hit with extra charges that first month because you think you have minutes rolled over-
"Rollover Minutes: Rollover Minutes accumulate and expire through 12 rolling bill periods. Bill Period 1 (activation) unused Anytime Minutes will not carry over. Bill Period 2 unused Anytime Minutes will begin to carry over. Rollover Minutes accumulated starting with Bill Period 2 will expire each bill period as they reach a 12 bill period age. Rollover Minutes will also expire immediately upon default or if customer changes to a non-Rollover plan. If you change from one rollover plan to another rollover plan, any accumulated Rollover Minutes in excess of the new plan's number of monthly Anytime Minutes will expire upon such change. If you migrate a single line to a FamilyTalk plan, or should a subscriber join a FamilyTalk plan for which your line is the primary line, any accumulated Rollover Minutes for all lines included in the new FamilyTalk group's Rollover Minutes in excess of the monthly Anytime Minutes for such group shall expire upon such change. Rollover Minutes are not redeemable for cash or credit and are not transferable. Night and Weekend and Mobile to Mobile Minutes do not carry over." -
Flash button with dynamic text
I'm trying to create a flash button so that it can toggle
between "Sound On" and "Sound Off" but I feel like I'm doing
something wrong and it errors out on me.
I have a button on stage as, and in my up/over/down/hit in
different colors I have a dynamic text field identified as
sound_txt.
Here's the script I have so far for my frame:
stop();
mutebtn.addEventListener(MouseEvent.CLICK,muteDo);
function muteDo(event:MouseEvent) {
if (mutebtn.sound_txt.text == "Sound Off") {
mutebtn.sound_txt.text = "Sound On";
} else {
mutebtn.sound_txt.text = "Sound Off";
and this is the error message I am getting:
TypeError: Error #1010: A term is undefined and has no
properties.
at buttontst_fla::MainTimeline/muteDo()
TypeError: Error #1010: A term is undefined and has no
properties.
at buttontst_fla::MainTimeline/muteDo()
Can someboy please advise as to how I can get this to
work?I tried bringing the textfield out of the button but while it
worked when I pressed the button portion that is not under the
text, it was the part of the text that got in the way from doing
anything. I wonder where I can find an existing example that works
the way I want it too so I can at least follow that example. I
think I tried making the dynamic text a movie clip but was still
getting similar errors.
Edit: I at least got it to work by converting the button into
a movie clip although I had also wanted it so that I could also
change the foreground color of the dynamic text upon rollover,
etc. -
Help with dynamic text and hand cursor
The buttons that I am creating are not displaying the hand
cursor. I tried searching for an answer, and have found nothing.
They are movieclip buttons with a dynamic text field. I already
switched them out to non-selectable text, and I am using:
b1.buttonMode = true;Perfect. I knew it was some little snippet that I was
forgetting. I made a temporary fix of creating a 0% alpha box over
the button like a fake click area above the text, and that worked
but I know that it was a half-arsed way of working around it.
Thanks. -
Help with code for score-keeping with dynamic text box
Hi All,
I'm having an actionscript 2.0 problem with keeping score.
I have a dynamic text box with a variable called score.
I have the following action code for that variable:
_root.score = 0;
For the correct answer button I have this action:
_root.score = Number (score) +10;
This works fine to increase the score by 10 for each correct answer.
The problem is that I can't get an if statement to work for when the score reaches 150 to gotoAndPlay a certain frame. I've tried various syntax, I've tried it on the action for a button and an action for the timeline with:
onRelease = function () {
(My learning game is set up to allow for users to answer up to four extra questions to reach the score of 150).
Nothing works. Any suggestions please?
PamBelow is a link to a small sample file. See if you can find anything different between your file and the one linked that might cause yours to not work as desired.
http://www.nedwebs.com/Flash/AS2_score_sample.fla -
Issues with dynamic text box formatting
I'm running into issues with using HTML formatting for a dymanic text field. I know these are quirky and I cannot figure out how to get the formatting proper.
I have on my stage a dynamic text box called "content_txt" inside of a movie clip instance "content_mc". When it enters the frame, I fade the "content_mc" from alpha 0 to 100 using a timeline animation. In order for this to work, I have to embed the font in my "content_txt" text field. However, the only way I get get the HTML formatting to work is if I do not embed the font.
The dymanic text field is set to render as HTML. In my actions layer, I set the text:
this.content_mc.content_txt.htmlText = "<b>Hello world,</b> it is me again."
In summary:
1. If I do not embed the font, the alpha fade does not work but the HTML formatting does.
2. If I embed the font, the alpha fade works but the HTML formatting does not.
How do I resolve this? It's driving me nuts!How do you embed just one style?
I've tried typing three words in the text field and formatting each (regular, bold, italic) but the text field just defaults to whichever format is first.
Also, I tried embeding the whole character list and did not have success. -
FONT issue in flash with Dynamic text
I dont even know how to start this thread... I am having a
serious problem with fonts on the flash movie I am Making/
Modifiying. The Font that is being used is "standard 07_53" and I
have been trying to understand how flash works with the fonts but
somethings are just making me scratch my head. First off :
- I tried using both the anti-alias for readability and the
anti-alias for animation... the anti-alias for animation seems to
creat sharper text in most cases.. + I am embedding all charachters
when I do that (I know this makes my file way too big, but I am
trying to figure out where I am going wrong)
- Q1 : I found out changing the position of where my text box
is on the document changes how clear the text is in the final
puplication. Now That I have not even the simlest idea why... does
anyone know?
- Q2 : The justify problem... whenever I use Justify my text
is all messed up... I even tried to change the font to Arial for
example and it still makes some of the text a bit blurry (well it
is blurry enough that I can notice it right away).. why does this
happen?? and is there any kind of solution to this problem?? I
definatly want my text justified
- Q3 : Do I and why, have to embed the font in each text box,
wouldnt one embeding be enough if using the same font in all the
other text boxes?
- Q4: Why do I see the text differently on different
computers.. and this realy is in relation to Q1.. on my monitor all
looks good on the published document, yet on other monitors and
computers it looks completely fussy untill I change the position of
that text box.
-Q5: are there any sites that go in depth about Fonts and
dynamic text and how they end up rendering in flash?
you can see my problem with justified text at :
http://www.alwayscoffee.com/mirror/flash/
then click on COMPANY and then look at the text under "ABOUT
US"
by the way I am using flash 8 and publishing (flash settings
of:) flash player 8 - action script 2.0 - compress movie option
CHECKED - and jpeg quality 80
I apriciate all the help I can get.
LaythHi,
as you I don't even know where to start, as it is (as you
have noticed) quite a complex thing. If you are still interssted in
the subject, drop me a line, and I try to answer some of your
questions.
markusma
_remove_thieu@macDOTcom -
Printing - With Dynamic Text Fields
Hello,
i wonder if anyone can help me........i know there are a lot
of posts already on how to print out dynamic text but all of them
seem to be using scrolling text fields.
However my problem isn't even as complex as this but i still
can't work it out.
At the moment i have a form of text boxes which the user
inputs text.............from here there is a print
button.........in order to compile all of the answers together i
have created a movie clip.........with the layout of the printed
page on it, and placed this on the main timeline. Inside this movie
clip to be printed i have dynamic text fields...which link to the
text fields which the users inputted data in, therefore both sets
of text fields contain the same data, when you change one the other
should change.
I have set up a very simple printJob command to print out the
movie clip named print_mc and it prints the page even the outline
of the text boxes but it doesn't print out the content which
appears on the screen. my code is attached below.......please if
anyone could help i would be very grateful :)
print_btn.onRelease = function() {
_global.aOneVar =oneAPone.text;
_global.aTwoVar =oneAPtwo.text;
print_mc.gotoAndStop("2");
var myPrintJob:PrintJob = new PrintJob();
var result:Boolean = myPrintJob.start();
if (result) {
myPrintJob.addPage("print_mc", null, {printAsBitmap:false},
2);
myPrintJob.send();
delete myPrintJob;
} else {
thankserictomlinson,
> So, if I turn off the xml/css and use htmlText to create
> content for the text field, the text uses the embedded
> font and is anti-aliased.
I'm with ya. Presumably, then there's a font symbol in your
Library,
right? And its Linkage identifier is "arial_font"?
> If I keep the xml/css but comment out embedFonts, then
> the content works but is not anti-aliased.
That's because your CSS calls for Franklin Gothic Book,
which hasn't
been imported into your Library as a font symbol (at least,
you haven't said
it has).
> I need both of these to work at the same time.
Give Franklin Gothic Book a Linkage identifier, and use that
name in
your CSS.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Hi, I was just wondering if anyone could help me out.
Basically, I'v created a dynamic text on the main timeline
with an instance name of "score". I then created a button within 2
movie clips. The idea is that when the button is pressed, I add to
the score. The code I'm using on the button is
on(press){
_root.score.text +=20;
I'm not an experienced actionscripter, I was wondering if
anyone could maybe tell me where I'v gone wrong and what to do to
make this work. Thanks xDHmmm.
Well officially the .text property of a textfield is a string
so what will happen is that the 20 gets turned into string and
concatenated (or appended) the the string value in the text
property.
Can you clarfify the problem? Is your textfield changing or
not?
If it is changing then you will need to do something like:
_root.score.text = Number(_root.score.text)+20;
That requires that a valid number already exists in the
textfield. It might be safer to track the score in a separate
variable and then assign it to the textfield's text property each
time it changes.
If its not changing then try putting a trace in to see what's
happening:
on(press){
trace("textfield is:"+_root.score)
_root.score.text +=20;
If you see 'undefined' then it may just be a typo - perhaps
you called it Score with an uppercase S for example. If its defined
and nothing is visible then it could be that you've embedded fonts
without numbers or something like that. -
New and need help - drag and drop with dynamic text
So I'm doing this project and as an animator I'm not familiar with the whole action script side of flash
Okay so far I've managed to create the whole Drag and Drop feature and it works well, the thing is I want to make it so when you drag in object in the correct spot and new text appears, and I need like six different object with the dynamic text. but I have no idea how to integrated it in my code or where I should start!
So i based myself on some tutorial so theres some code in there that had dynamic text, but not exactly what i wanted
Your help would be much appreciated!
This is my code:
var counter:Number = 0;
var startX:Number;
var startY:Number;
six_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
six_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
five_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
five_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
four_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
four_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
three_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
three_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
two_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
two_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
one_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
one_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
reply_txt.text = "";
event.target.parent.addChild(event.target);
startX = event.target.x;
startY = event.target.y;
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
reply_txt.text = "Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
} else {
reply_txt.text = "Try Again!";
event.target.x = startX;
event.target.y = startY;
if(counter == 6){
reply_txt.text = "Congrats, you're finished!";
six_mc.buttonMode = true;
five_mc.buttonMode = true;
four_mc.buttonMode = true;
three_mc.buttonMode = true;
two_mc.buttonMode = true;
one_mc.buttonMode = true;where you have
xxx.text = ....
is where you're assigning text. -
Alerts with "Dynamic Text". Alert ID is unknown.
Hello,
I have set up an alert category with option "Dynamic Text" activated as I want to use some custom container variables in BPM.
When the appropriate control step in BPM is executed not alert is triggered.
If I try to trigger a test alert using report RSALERTTEST I get the following error:
Alert ID is unknown. Maybe the alert was not created.
Both works fine when I use a an alert category without "Dynamic Text" selected. What could be the reason for this?Just got the alert from the integration process. RSALERTTEST still gives the same error, but most important is that the alert works during runtime.
Maybe you are looking for
-
Hi, My Iphone4 won't go onto the internet through apps or safari, it was fine BEFORE it was activated through wifi but now even that doesn't work. I've tried the reset and removing the sim etc. Anyone got any clues??
-
DISAPPEARING KEYBOARD LETTERS - PAVILION DM4
Has anyone else experienced the white painted letters coming off the keys of a new Pavilion dm4? The letters started coming off shortly after it was purchased. We bought the laptop for my wife to use and, understandably, she has not wanted to part
-
Hi, How to get sum of quantity from each table based on Recipe Id from Raw Material Preparation table. Ex: Raw material preparation table can have multiple records in Vacuum mixing table like wise Vacuum mixing table can have multiple records in Mate
-
Hi I am new to Apple devices, i got a new Ipad mini and i am trying to download skype from the Istore,it asks me to review my account and if i give all the details and click on next, it come to the same page,please help
-
How to compress a batch of pdf files in different sizes to a specific target (20 mb)
Hi, How do I compress a batch of pdf files in different sizes (21-39 mb) to a specific target (20 mb)? Thanks:)