Dynamic text resizes when loaded?
I made sure to set the stage to noScale but I am still having
a strange problem that is driving my nuts. If I make a static text
box it will not resizing when I compile and preview or upload the
swf. However, if I make a dynamic text box, the text size increases
slightly when i complile the swf. This makes fine tuning the layout
of web pages extremely difficult because what i see on the stage is
not the same size as what i see when the swf is complied. Has any
one else had this problem or know how to solve it because its
really starting to drive me nuts?
The only time you should see a size difference is when you
take text out of a movie clip that has been scaled. Hit Crtl-t to
get the Transform window and see if the object is %100
Similar Messages
-
Linking a class to a dynamic text field to load XML data.
Hi,
I'm quite new to ActionScript and would be grateful for any help here.
I want to load text into a dynamic text field (called 'about_tab') using a class depending on the language selected (by clicking on a flag icon) by the user.
I managed to get this to work when the ActionScript was written directly in the timeline, but am having problems with doing the same thing via a class.
This is my class file:
package
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
public class ChangeLang extends SimpleButton
public function ChangeLang()
addEventListener(MouseEvent.CLICK, switchLang);
trace("ChangeLang class working");
public function switchLang(event:MouseEvent):void
var lang = event.target.name;
var req:URLRequest = new URLRequest("languages/"+lang+".xml");
var loader:URLLoader = new URLLoader();
var substance:XML;
function xmlLoaded(event:Event):void
trace("function xmlLoaded is running");
substance = new XML(loader.data);
about_tab.text = substance.about_lbl;
loader.addEventListener(Event.COMPLETE, xmlLoaded);
loader.load(req);
Here's one of my XML files (the other is the same except "About" is written in German):
<substance>
<about_lbl>About</about_lbl>
</substance>
When I run it, it returns my trace statements that the class ChangeLang and the function xmlLoaded are running, but no text appears in the dynamic text field (I should/want to see the word 'About'). I get this error message:
1120: Access of undefined property about_tab
The problem, I'm guessing, is in the part in red in my code. I think I need to target the text field in the display list by creating a reference to it. If so, could someonw point out how I do this, or perhaps a tutorial that would help. I've tried adding the word stage (i.e.,stage.about_tab.text = substance.about_lbl; ) but it still doesn't connect. I guess there's something really simple I'm missing, so I apologize if this comes across as a stupid question
Thanks for any help.Hello flashrocket!
I'm also new to AS3 and I've just started using external classes and I think I know what you should do to put your code to work.
Instead of using the text field you created inside your flash file, why don't you use the "TextField" class to create an instance of this object? It's the exact same thing as when you create and instantiate a new text field inside Flash.
First, import flash.text.*; (includes classes like TextField, TextFieldAutoSize, TextFormat, TextFormatAlign, etc)
Than you just have to create a var like
public var about_tab : TextField;
or
public var about_tab : TextField = new TextField();
then, to adjust the properties of this tab you use dotsyntax as if it where on your stage like:
about_tab.x = 50; about_tab.alpha = .5; etc...
you can even create a function to "config your textField"
private function createAndConfigTextField() : void {
about_tab = new TextField(); //you only need this line if you
// only typed something like "public var about_tab:TextField;
// if instead you used "public var about_tab:TextField = new TextField(); outside
// this function, just skip this first line because you already have an instance of
// text field named "about_tab"...
about_tab.autoSize = TextFieldAutoSize.CENTER;
about_tab.background = true;
about_tab.border = true;
var aboutTextFormat : TextFormat = new TextFormat();
format.font = "Arial";
format.color = 0x000000;
format.size = 11;
format.bold = true;
format.align = TextFormatAlign.CENTER;
about_tab.defaultTextFormat = aboutTextFormat;
addChild(about_tab);
This is just an example of what you can do... I hope you get it... let me know if you have any doubt... -
Dynamic Text in Externally Loaded swf
hi. i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.
this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).
here is the sample code:
var loader:Loader = new Loader();
loader.load(new URLRequest("loader.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void{
addChild(loader);
var loader_mc:MovieClip = (loader.content as MovieClip)
loader_mc.myMovieClip.gotoAndStop(2);//***this works
loader_mc.myButton_btn.addEventListener(MouseEvent.CLICK, clickMe);//***this works
loader_mc.myText_txt.text = "12";//***this doesn't work******
please help. thanks!Did you embed the font in the textfield--it needs to be done in the loaded swf when you create it? One other thing to check is that the color for the textfield is not the same as the background it sits on.
-
Dynamic text shifts when style changes
I have some dynamic text fields that are set up so that when
you rollover them (actually a button behind them), their formatting
changes. This is done with some basic actionscripting, setting up 2
different text format variables and attaching one or the other to
the text field when a button is rolled over. The only thing that
changes is color. When the text first appears all is well. But when
you rollover the text and the color changes, on certain browsers an
extra space can get inserted at the beginning of a new line, sort
of like the old bug where text wrapping messes up and moves a space
down to the beginning of a line. This happens on IE 6 and 7 and
Safari, not Firefox. The player is 9. THanks.Did not, I was happier with the browser's display than with
the embedded font version. May try it just to see if problem
remains. Seems like something I should be able to avoid without
having to embed though. -
Dynamic text disappears when clicking bold button.
Dear friends,
I have dynamic text inside a movieclip, that I can make it rotate.
the dynamic text properties are : anti-alias for anmations and I emdedded all characters.
When I click on the bold button the the text disappears.
bold_btn.addEventListener(MouseEvent.Click, on_bold);
function on_bold(e:MouseEvent):void
var my_format:TextFormat = new TextFormat();
my_format.bold = true;
my_mc.my_txt.setTextFormat(my_format);
How can I solve this problem.the easiest (and not very elegant way) is to add textfields that contain those fonts (and embed them). you can remove your textfields from the display list or otherwise, make them not visible on-stage.
-
Problm in dynamic text field when i view it in IE
Hi
i have used dynamic text field for UI Lebels, text is comming
from xml file.i have TextFormat as well .
when i publish and see out put in swf file it is looking good
and all the text in the same place where i have placed it. but if i
see it in IE browser.
all text is moved littile bit as well as its not taking
formating of the text .. means if i have used Arial bold 10 .. but
is not showing bold ...
can any body help on this issueIt is a very simple to solve issue:
There is a line break in your CSS code on the main page in the background image url.
Current Firefox versions do not like that.
<code>body {
background:#000000 url("http://lh4.ggpht.com/_fKjKe5YUrXg/SjKITFBNaxI/AAAAAAAADWI/u5ohtFDhVc0/black-%20lighter.jpg
background-position: down-left;
background-attachment: fixed;
background-repeat: no-repeat;
margin:0;
color:#E895CC;
font: x-small "Trebuchet MS", Trebuchet, Verdana, Sans-serif;
font-size/* */:/**/small;
font-size: /**/small;
text-align: center;
</code>
This should fix it:
<code>body {
background:#000000 url("http://lh4.ggpht.com/_fKjKe5YUrXg/SjKITFBNaxI/AAAAAAAADWI/u5ohtFDhVc0/black-%20lighter.jpg");
background-position: down-left;
background-attachment: fixed;
background-repeat: no-repeat;
margin:0;
color:#E895CC;
font: x-small "Trebuchet MS", Trebuchet, Verdana, Sans-serif;
font-size/* */:/**/small;
font-size: /**/small;
text-align: center;
</code> -
Dynamic text blurry when preloader is used
I've put the skeleton of something here:
http://www.leetilford.com/tests/portfolio.html
Note the crisp type up front. Choose a category (bathroom or
dining for instance) and see that the dynamically loaded type
becomes blurry.
This only happened when I used a preloader to load the
category swfs, anyone know why?
The crispness of the Portfolio type is how they all render
when no preloader is used.
Baffling?Yes. I just deleted all text boxes (including buttons) and
made
sure all boxes were set to static, anti-alias. But, that kept
me from needing to embed.
I had embedded the fonts before.
The files are clones of the portfolio.swf which comes up
nicely. However,
that one is not preloaded.
This is what I'm using for a preloader:
stop();
//-------------preloader------
//make the preloader bar not appear "full" right away
bar_mc._xscale = 0;
//load Movie into level 1
loadMovieNum("exterior.swf", 1);
//note the movie to load has a blank first frame.
onEnterFrame = function () {
_level1.stop();
// get the bytes of Level 1 and make into a percent
percent =
Math.ceil((_level1.getBytesLoaded()/_level1.getBytesTotal())*100);
//use the percent to determine the xscale of the preloader
bar.
bar_mc._xscale = percent;
// if loaded play level1
if (percent>99) {
//note you MUST delete onEnterFrame otherwise it
//will continue to run.
this._visible=false;
delete this.onEnterFrame;
_level1.gotoAndPlay(2); -
Text resizes when cutting and pasting
Help? When I cut and paste text from one scene or area to
another, the text changes sizes and does not look uniform to the
next. How do I eliminate that or at least figure out how to make
the text the same size (re: the original text may be 32, but the
pasted text - at 32 - is much larger.)?The only time you should see a size difference is when you
take text out of a movie clip that has been scaled. Hit Crtl-t to
get the Transform window and see if the object is %100 -
How to Stop window from resizing when loading a project
Every time I load any project (even one I saved and closed 5 minutes ago) After Effects resizes the window. I would like to disable this 'feature' how do I do that?
Check your workspaces and also your graphics card stuff. Especially in a multi-screen setup your graphics driver may simply be resetting the application window to the primary/ first screen.
Mylenium -
Load Multiple Dynamic Text Files in Different frames on Maintimeline
Hello!
I have managed to load an external text file in one place one the maintimeline. I would like to do the same thing on other frames. When I go to duplicate the same thing that I did on the first one I get a duplicate textReq request. Do I need to give the textReq a more specific name for each section? When I did this the movie wouldn't even recognize and of the code that was working before.
Can anyone help me with this code? Thanks in advance
I am attaching link so you can see sections I am talking about. Also you will notice that the swf file I loaded won't go away. That's another problem...ugh.
Here is link:
http://www.sandraschmitt.com/coclico/index100.html
Here is code on maintimeline:
stop();
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad() {
var swfLoader:Loader = new Loader();
var swfRequest:URLRequest = new URLRequest("endlessCoclico3.swf");
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
swfLoader.load(swfRequest);
function onCompleteHandler(loadEvent:Event) {
addChild(loadEvent.currentTarget.content);
function onProgressHandler(swfProgress:ProgressEvent) {
var percent:Number = swfProgress.bytesLoaded/swfProgress.bytesTotal;
trace(percent);
startLoad();
//handle events for buttons...
collections.addEventListener(MouseEvent.CLICK, clickSection);
raison.addEventListener(MouseEvent.CLICK, clickSection);
stores.addEventListener(MouseEvent.CLICK, clickSection);
news.addEventListener(MouseEvent.CLICK, clickSection);
contact.addEventListener(MouseEvent.CLICK, clickSection);
home.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection(evtObj:MouseEvent) {
//trace shows what's happening... in the output window
trace("The "+evtObj.target.name+" button was clicked!");
//go to the section clicked on...
gotoAndStop(evtObj.target.name);
Here is code on actual frame where the dynamic text is working:
//Loaded exteranl text fields
var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest = new URLRequest("text_philosophy.txt");
function textLoaded(event:Event):void {
philosophy_txt.text = textLoader.data;
textLoader.load(textReq);
textLoader.addEventListener(Event.COMPLETE, textLoaded);Textfields: What I like to do, mainly for peace of mind, is to have a layer that I dedicate to actionscript that only has code in frame 1 but it extends the full length of the timeline so that this code is available to every frame on any other layer. In this frame I put variables and functions that can get used/shared wherever they happen to be needed. I usually create another separate layer for actions types of actionscript... stuff that happens at the local frame level, like stop();, or like assigning a variable a new value, etc... things local to being at that frame/location. So with that in mind
In frame 1 on my shared-by-everyone layer, I'd probably declare the variable....
var textReq:URLRequest;
And when I get to a particular frame where I want to load a new textfield with data, I assign that var its value on the local actions layer...
textReq = new URLRequest("text_philosophy.txt");
along with the rest of the local execution regarding loading the file, etc...
SWF's:
Yeah, pretty much, and it becomes an object that has a home on the timeline, so if you move away from that frame the swf doesn't follow. -
Dynamic text doesnt load in container
hey,
like the headline says i have a problem wit a dynamic text which i load from a .php file
Just in a container, if I load it on its own it works correctly
example: www.borgball.at.tc (Gästebuch)
www.borgball.at.tc/gaestebuch.swf
its the same file both times.
Structure: Main(root)-->container
code:
count = new LoadVars();
this.onEnterFrame = function(){
if(main.maxscroll > 1){
main_balken._visible = true;
}else{
main_balken._visible = false;
count.load("count_guestbook.txt?nocache="+new Date().getTime(), 0);
count.onLoad = function(ok_1) {
if (ok_1) {
counter.text = this.zahlguestbook;
} else {
counter.text = "0";
read = new LoadVars();
//read.load("guestbook.txt?nocache="+new Date().getTime(), 0);
read.load("auslesen.php?nocache="+new Date().getTime(), 0, "POST");
read.onLoad = function(ok_2) {
if (ok_2) {
mainframe.htmlText = this.main;
} else {
mainframe.htmlText = "<b><br>Keine Einträge vorhanden!</b><br>Text konnte nicht geladen werden!";
signal = 0;
stop();this is the index.html page that i'm loading and it's not correct:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Powered by FlashVillage.com</title>
<style type="text/css">
<!--
* { margin:0; padding:0; }
html { height:100%;}
body {
height: 100%;
overflow:hidden;
.Stil1 {color: #000000}
-->
</style>
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="index.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="index.swf" quality="high" bgcolor="#000000" width="100%" height="100%" name="index" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html> -
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 -
I don't know if this is a bug. I have a movie that contains a
dynamic text. When I run it, the text displays fine. But when the
said movie is run through another movie clip (using loadMovie), the
dynamic text won't display. Any ideas why? Thank you.dongzky wrote:
> Actually, there was no code involved. The dynamic text,
with borders around it,
> I tried to put a value for testing. It works fine when
run. But when called
> by another movie clip, although the movie with the
dynamic text still loads,
> the text won't display anymore. Even the borders were
gone.
Than again, it's a bug on your end :)
Dynamic text is a text container, it's to be use with
dynamically given data, from
source file or variable string on timeline. It's not meant to
be for regular text
display. You need to use Static text. The fact that you can
see it it's just flash
being tolerant but it only lasts for as long as the movie is
getting more complex.
You can get away with somethings even tho you should not be
using them, does not
mean they will work all the way. Dynamic text, as said above
is for text that comes
to flash from outside source and this is when it works best.
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Dynamic text problem in flash cs5
Hi guys,
im building a flash website and the first page has dynamic text fields that load text via xml, that all works fine. But when i create a dynamic text field further up the time line for the second page ( i use the same code all at the fist frame of the timeline) and nothing loads. if i have an instance of the text on the first page at the start of the time line it will load on the next page (further up the time line). Ii have stop and click to go and play in the code to break up the pages.
I am a little lost, as i normally use static text.
any help would be greatly appreciated.
cheersAh found out myself the hard way that i need to put the text feild inside its own symbol!
only took me all morning -
Dynamic Text not loading when browser refreshes
Hi All,
For some reason, when the user refreshes the browser, the 'Welcome to our ....' dynamic text in the middle of my swf doesn't load in IE 8. I think this is somehow cache related maybe?
I'm using a preloading container .swf to load the main movie swf, Interactive_StrategyMap.swf (located here: http://precorp.coop/fileshare/map/Interactive_StrategyMap.swf).
You can view the behavior here: http://www.precorp.coop/fileshare/map/InteractiveStrategyMap.html
Any ideas how I can fix this?
Thanks,
JohnNed... Ahh, it appears to be happening to me because I have the Tools/Internet option in IE selected "Check for new version of stored pages" to Automatically.
Maybe you are looking for
-
HI.. I'm having an issue while installing obiee 11g(11.1.1.7.0) in windows server 2012 and using the database as ms sql server 2008. During configuration process after the installation process is completed , here the process is stopped at "Step:execu
-
My new 30GB iPod doesn't show in iTunes so I am unable to put any music on it. Also, the updater does not recognize it either, but my computer recognizes it as a removable drive so it knows it's there. This problem does not only persist in my new iPo
-
How can I create a cron schedule that repeats every 2 weeks on Mondays?
I need to create a cron schedule that repeats every 2 weeks on Mondays. Cronmaker.com doesn't have the cron expression for this. Please advice. Using calendarSchedule I can do this, var trigger = TriggerBuilder.Create() .StartAt(new DateTime(2012, 11
-
Hi, I want to compare 2 xml files and identify the difference in the values between the tags and log it across in a table. I am new to this xml stuff in pl/sql.Can someone please help me with letting me know how to compare 2 xml files in Oracle using
-
OID populate other http request attributes
I am trying to figure out how to customize my OID SSO so that it adds attributes to the HTTP Request. I have used the name mapping java module to customize my certificate the OID user mapping. I imagine there has to be a similar interface for additio