Dynamic text box and minus variable?
I have a text box with dynamic text set to display p variable but when the variable goes < 0 it only displays a '-'.
im using:
onClipEvent (enterFrame) {
p = my_object._x;
How can I correct this? Also another question with 'my_object._x' it returns the x coord relative to the movie clip it is in. How do I get the position relative to the 0,0 (top left corner)?
I've been learning Flash for 2 days so sorry if the questions sound simple. I have tried googling these.
for the textfield question....
I'm not too sure about that... it could be related to the width of the textfield, or maybe a maxChars setting on the textfield....not really sure sorry. Someone else may have an answer....
for the other question...
getRect() gives you the bounding box (without stroke width, use getBounds() if you want bounds outside the stroke width)
try
var geometricBounds = my_object.getRect();
trace(geometricBounds.xMin+","+geometricBounds.yMin)
Similar Messages
-
How can i set the dynamic text box to show variable value?
In AS2, I can make a dynamic text box set a var name, when i
use button set/change the var value, this textbox can show the
value also.
but In AS3, dynamic text box can't add var name. than how can
i do it now?Set an instance name for the dynamic textfield. Then, to
populate the textfield with the value of a variable, use:
textFieldInstanceName.text = variableName -
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 -
Flash 7 dynamic text box IE issues
Hi all,
I am having issues with IE V.6.0.3790.0 not loading dynamic
text into text boxes inside a Flash 7 SWF on a remote desktop. Does
anyone know of any compatability issues with dynamic text boxes and
IE? The file loads properly into Safari on my MAC, and I have the
latest Flash Plugin installed. Could it be a Plugin issue, rather
than a IE issue? The reason I am asking is I have a site launched
and many people cannot see the pages that pull in Dynamic text. I
am trying to either get to the bottom of it and provide a fix, or
at least come up with some answers!quote:
Originally posted by:
AnandMX
use embedFonts=true
coz it seems that your fonts are not embedded thats y it is
not visible there.
Thanks - but why would the fonts be visible in Safari and
Firefox, for example, and not in that version of IE? -
I have created a dynamic text box and an input text box.
I have produced code that replicates whatever is typed in the
input box to display in the dynamic box along with a date and time
stamp once a button is clicked.
This all works fine, except for the sizes of the fonts. for
both boxes, i selected font size 10 . The input box is fine,
however the dynamic box text is huge.
When i make the dynamic text font smaller, it fits in fine,
but the input text that is inserted into the dynamic text box comes
in too big. If i make the input text box font smaller it is
unreadable when typing it in.
any soultion to how to make my font consistent. I am assumin
the problem is because both the text boxes are different sizes,
however i don't know how to resolve the issue.
Any help is much appreciated.
Laurahi laura
i think the problem it's in the targetPath "
mainClip.newspaper_mc.newinstructions.text =
lu.welcome[langIdx];".
chech if you have mistype the instance names of your
movieClip and rewrite it or in the Actions panel select the path "
mainClip.newspaper_mc.newinstructions" and click the button
"Insert Target Path" this will open a popup with a tree of your
MC's on the stage, so you can browse and find the textfield. i hope
i helped you if not let me know! -
Dynamic text boxes, font size issues
I have created a dynamic text box and an input text box.
I have produced code that replicates whatever is typed in the
input box to display in the dynamic box along with a date and time
stamp once a button is clicked.
This all works fine, except for the sizes of the fonts. for
both boxes, i selected font size 10 . The input box is fine,
however the dynamic box text is huge.
When i make the dynamic text font smaller, it fits in fine,
but the input text that is inserted into the dynamic text box comes
in too big. If i make the input text box font smaller it is
unreadable when typing it in.
any soultion to how to make my font consistent. I am assumin
the problem is because both the text boxes are different sizes,
however i don't know how to resolve the issue.
Any help is much appreciated.var today_date:Date = new Date();
var date_str:String =
(today_date.getDate()+"/"+(today_date.getMonth()+1)+"/"+today_date.getFullYear());
var my_date:Date = new Date();
var boat = ""
btn_send.onPress = function() {
var today_date:Date = new Date();
var date_str:String =
(today_date.getDate()+"/"+(today_date.getMonth()+1)+"/"+today_date.getFullYear());
var my_date:Date = new Date();
date_txt = date_str + " " + my_date.getHours() + ":" +
my_date.getMinutes() + ":" + my_date.getSeconds() + " " + boat;
the text appears in the dynamic box it just is a mish mash of
font sizes!!! -
Dynamic text box, HTML Text with Image
Hello Everyone,
I am using Flash version 8. I have used the text tool and
created a dynamic text box and have attached the UIScrollBar
component to it. This text box is configured to allow the use of
html text to be inputted to it. I have code that reads a file which
contains a list of text files that I then read and place them into
the text box. The user can use the scroll bar to scroll through all
the text.
I have created an image that is a picture of the tab portion
of a file folder. On the tab I have place some text. This was all
done in Photoshop. This tab image is used to separate the different
stories in the text box. The image is save as a jpeg file
Everything you have just read works with out any problems.
Now for the problem!
This image is only 20 pixels tall and the text is not very
readable. As we all know the HTML tags are very limited in Flash 8.
Ideally I would like to put the text and image in to the text
box as I would normally do. Then place text on top of the image and
have it all scroll properly with in the text box.
I have taken the tab image and converted it in to a graph
symbol and then put the text on top of the image. This looks good;
however I don’t know how (or if it is even possible) to place
the graphic symbol in to the text box at the correct place within
the text.
Does anyone have ideas on what may work? Remember that the
image I am working with is only 20 pixels tall which is why the
text quality on the image is so poor.
Thank you all for any help you may provide,
SteveYes Tim I am using the <img> tag and I know that I
can’t place text over the image. I have set the height and
width to be the exact size of the image. However When you go to the
webpage it will open the movie to the maximum size based on the
resolution of your display; however I do maintain the aspect ratio
of the movie. For testing I did set a fix size to the size of the
movie. Sometimes the fix size (1000x750) looks better and sometimes
a larger size (example 1280x1024). I believe that the main problem
is the fact the size of the image is 670 pixels wide by 25 pixels
high and of the 25 pixels the text is only 18 pixels tall. In
Photoshop this makes it about a 1.75 point font. As you can see the
real problem is that I don’t have enough pixels to make up
the text. This is why I am looking for an alterative way to create
the text.
I tried importing the image into flash as a graphic symbol
and then using the text tool to create the text. The results looked
real sharp, the text was nice and crisp (just what I wanted). The
problem is that I could not find a way to place the graphic symbol
into the dynamic text area like id did using the <img> tag.
This symbol needs to scroll as you scroll the text in the text
area.
This is why I am asking for help. I am looking for some ideas
that may work.
Thank you,
Steve -
Dynamic Text box with linking to frames
I have a problem. I've tried everything I can think of and what I have Googled, but nothing has helped. I have a scrolling dynamic text box and I need some words in that text box to link to frames, like buttons (Not a URL). This is the file and the frame I'm on is "conflictNorthernPlains" https://dl.dropbox.com/u/72608572/civilWarEra7.zip
Thanksuse:
var tf:TextField = new TextField();
addChild(tf);
tf.htmlText = "<a href='event:frame1'>link to frame1</a><br/>";
tf.htmlText += "<a href='event:frame2'>link to frame2</a><br/>";
tf.addEventListener(TextEvent.LINK, tfF);
function tfF(e:TextEvent):void{
gotoAndStop(e.text);
p.s. please mark helpful/correct responses, if there are any. -
Text arrays (variables) and Dynamic Text Box
Hello everyone. I have a text file (let's call it sample.txt)
that has numerous variables or arrays in this format:
&info=This is some information
&stuff=This is more stuff
&whatever=Even more stuff again....
Anyway, I need to load a particular variable via individual
buttons from this same sample.txt file into a dynamic text box
(let's call it dynText), and I am a bit lost as to how to do it.
Please provide me a solution thank you.
GlennThank you very much, it's greatly appreciated. It worked
perfectly except that it does not like variables that begin with
numbers like:
&401_2b=401_2b
The above doesn't work, but if I do this...
&h401_2b=401_2b
Everything is fine. Problem being, I am generating the
variables via PHP and therefore cannot "change" them. Can you
provide me with a way that ActionScript can "see" the variable that
starts with a numeric value? Thanks for your time.
Glenn -
Getting file data and displaying it in a dynamic text box
The purpose of this function is to load and display a
specific menu for a restaurant (lunch, dinner, dessert, etc.)
This script is located inside of a movie clip that has the
text box and buttons.
There are 4 buttons that have event listeners that go to a
function that determines which button was pushed, and then sends a
call to loadMenu with a string that has the filename.txt.
In frame 1 of the movie clip, the variables used in the code
are declared as such:
var newMenuRequest:URLRequest = new URLRequest();
var newMenuLoad:URLLoader = new URLLoader();
var loadThisMenu:String = ""; //This is the variable the
buttonclick function alters and sets as the string to send to the
loadMenu.
My error is 1195: attempted access of inaccessible method url
with static type flash.net:URLRequest
Any ideas?quote:
Originally posted by:
GWD
newMenuRequest is an instance of a URLRequest.... and it
doesn't have a url method.
It has a url property.
I would be inclined to create a new URLRequest each time. But
perhaps that's not necessary.
Try changing
newMenuRequest.url(menuName);
to:
newMenuRequest.url=menuName;
see if that works.
Yeah I realize it's a little inefficient.
THANK YOU SO MUCH FOR THE SUGGESTION. works perfectly. -
Targeting Dynamic Text Box inside moviecip with variable
Hi,
How does one target a dynamic text box to change the border
color inside of a movie clip? Example below which does not work
theName = ("answerPrint" + arryCount);
boxName = ("box" + (arryCount+1));
_root.pagePrintPartA[theName][boxName].border = true;
_root.pagePrintPartA[theName][boxName].borderColor =
0x00cc66;Thanks for the reinforcement, but I should of indicated what
was what:
theName = ("answerPrint" + arryCount);// Name of Variable
inside Dynamic Text Box Inside MovieClip
boxName = ("box" + (arryCount+1));// Instance Name of Actual
Dynamic Text Box Inside MovieClip
_root.pagePrintPartA[theName][boxName].border = true;
_root.pagePrintPartA[theName][boxName].borderColor =
0xFF0000;
By certifying this script you showed me wher I went wron (not
seeing the forest from the trees). The last two lines should be:
_root.pagePrintPartA[boxName].border = true;
_root.pagePrintPartA[boxName].borderColor = 0xFF0000;
I was targeting backwards. Thanks alot DazFaz. -
Can I put Chinese and English characters in the same dynamic text box?
I'm translating a game into several different languages, one of which is Chinese. I've noticed that in a dynamic text box where English characters are included also, they aren't displayed when the .swf is exported. The font is embedded in the document with all characters selected. It seems like whatever language-character is first displayed in the text box, the other language cannot be. For instance, if there are Chinese characters first, then English, the English will not display, and vice-versa. Any work around on this? I am using Flash CS5 and Actionscript 2.0. Thanks!
Kglad - I'm not sure I follow your instructions for the fix. I assume you want me to set the _visible property to false via Actionscript ( textInvisible._visible = false; ). What is the purpose of this second text field - does it need any specific content in it to function? It doesn't seem to work to fix the problem but maybe I'm misunderstanding.
-
Hi,
At the moment im using the variable option of a dynamic text
box to load text. The variable is loaded into the swf via an
external htm file that has multiple variables in it (i dunno if
that makes sense but you know how you can load in a set of
variables from an html like eg. down below):
Anyway, now i want to have 10 different movie clips that act
as buttons, so that when they are clicked, they change the variable
of the dynamic text box soo it loads a different section of text
from the html file. I have tried the .variable property of the text
box but still no luck. I looked at another thread else where but i
dont understand exactly how they are changing it there. I'll copy
in the link anyway just incase it helps or someone can explain what
they are doing. Can anyone help me with this??
Thanks in advance for your help
Cheers
Damienhaha Oops. Heres the link to that other thread. My bad.
http://www.flashmove.com/forum/showthread.php?t=11070 -
How to get the text boxes and select lists dynamically?
Hi,
I have a requirement such that I need to create the text boxes and select lists depending on the user input at the run time. It means that if the user requires four text boxes/select lists then I need to have 4 such thing. If the user need 6 then I need to have 6.
The design may be such that initially only one text box/select list will be available when the page launches. Then as ad when the user asks for more those will be available to the user accordingly.
regards,
Dipankar.You can use Ajax to call textboxes and select list based on what user enters.
Otherwise make those items conditional and based on what user enters you can display textbox or select list.
You can call Single Textbox and Select List using Ajax for any number of conditions.
Regards
Chandra -
Displaying the result of a calculation in a dynamic text box
Hi folks,
I'm having a very minor issue here (operator error, I'm sure ). With the help of some folks here, I've created a series of calculations, and I've got that part down. Now, I just need it to show up in the movie.
I've created the dynamic text box in Flash (CS3), but when I hit test, it won't show up.
After all the calculations, I should have a figure that I call totalmoney. My dynamic text box is called total. The user doesn't need to hit anything for it to appear. It just appears as part of the movie.
Here's my code:
stop();
var startDate:Date = new Date(2010,0,12); // use your startyear, startmonth, startdate in the new Date() parameters.
var currentDate:Date = new Date(); // assuming user's clock is correct and in your timezone. else use server date/time.
var numberOfSeconds:Number = (currentDate.getTime()-startDate.getTime())/1000;
var interest:Number = (numberOfSeconds*0.74356);
var totalmoney:Number = (interest+15,000,000);
function displaytotal(evt:TextEvent):void {
total.text = "totalmoney";
Any thoughts?
Thanks!
NapoYou didn't have to bury any of the calculations in the function--leaving it as you had it is better. They could remain where they a=werew, and you'll probably find you want them outside it if you have other plans for using them. If left inside, they only have scope inside. In the programming world, it's good to think of functions as things that do one thing and one thing only (though it isn't often practiced that way)--it's called modular design.
When you place an event as an argument for a function, it typically means that there is an event listener that initiates the call to the function. If you work with buttons you'll see what I mean. But if the plan is to create your own call to a function when you desire it as such, not have it driven by an event listener, then you don't need to pass any event to it, though you may pass some other type of variable to it if need be.
For instance, what you have now will call the function without an argument because the function has the value built into its code....
displaytotal();
But you could also make the function a little more generic and set it up to recieve the value instead as an argument...
function displaytotal(amt:Number):void {
total.text = String(amt); // an earlier error of mine
displaytotal(totalmoney);
That would make your function a little more useful. Now it could be used to display other Number variables as well.
// my earlier error was that a textfield displays text, so you need to convert the Number value to s String.
Hope I'm not confusing you.
Maybe you are looking for
-
How to uninstall OS 9 without deleting Classic running Tiger?
OS 9 has become unusable, but it works fine in Classic Mode. I tried doing a reinstall and doing a clean install. I thought it would remove the old OS 9 and reinstall a new version. Instead it created a preveous folder of OS 9 and reinstalled another
-
Unable to open Adobe CS3 on windows 7 home premium 64 bit
I recently got a brand new machine with Windows 7 Home Premium 64 bit. I installed CS3, everything worked just fine but when I try to open it nothing happens. Anybody know what the problem is?
-
Modify the title of a wad report at run time.
Hello Gurus, i have a query in a report which lists the products.On clicking on a product, it takes me to anthr template which has the details of that product.The current scene is that whenever the user selects a product its detail report opens in a
-
Why can't I install apps on my phone? Permission Wizard will not let me!
When I try to install apps on my Lumina 822, it says that I need permission from a parent (mind you I am 35 years old), and it redirects me to the Microsoft Permission Wizard (?). I follow the steps and give permission and sign in with my hotmail ad
-
just bought 3 ipads for the family over the weekend at the flea market. they were all in closed sealed boxes. 2 ipads synced just fine and are working great. the 3rd however is being an issue. it says that it is already linked to an email. does that