No Dynamic Text will correctly show, why? - actionscript-3

I am learning rudementary flash, and have a book in hand; but am beginning to wonder if there is something wrong with the program or my computer. The following should be simple but only gives me nothing in the dynamic text box or just pieces of letters.
Frame 1
var amount:Number = 1;
Frame 2
howmuch.text = String (amount);
and....nothing ever shows....like ever. I've used this in a simple loop according to the actionscript 3.0 lesson including an amount++ function to make a simple counter.
I'm trying to get each concept and build on it, but have been here at lesson one for days.
using Adobe Flash CC on an iMac I bought here in 2013 running Mountain Lion.
Help please.

Because your text field is a dynamic one you may need to embed the font. Also check if the text color is not the same as the color of the background.

Related

if statement skipped , uppercase letters not displaying

I'm making a mini game for my multimedia class using Adobe Animate with ActionScript 3.
The first question requires the user to fill in the blanks to print "hi" like in python.
the question looks like this
_____("hi")
then you would fill in the blanks and click on a check answer button.
Then to check if the answer is correct I use an if-else statement like so :
import flash.events.MouseEvent;
stop();
checkBtn1.addEventListener(MouseEvent.CLICK, checkClick);
function checkClick(event:MouseEvent): void
{
if(input1.text == "print")
{
ans1.text = "Correct!";
}
else
{
ans1.text = "Wrong answer!";
}
}
However, even if the input is correct, it will skip the if part of the code and run straight into else.
It also won't display uppercase letters?
It'll display "rong answer!" ignoring the uppercase "W".
Any ideas?
#Organis is right; The font needs to be embedded.
Flash Professional CS5 (and later) automatically embeds any characters used by text fields on the Stage. However, if you are using Dynamic or Input text fields, the project may also need to include characters for the font that aren't specifically contained in instances on the Stage during authoring. If you do not embed the necessary characters and text elements are programmatically displayed or entered by the user, the characters may be missing and the application may appear broken.
Common Mistakes Working with Fonts and Text Objects in Flash
For help embedding fonts, refer to the Adobe documentation on it.
Embedding Fonts with ActionScript
Embedding Fonts in Adobe Animate (Flash)

Flash CS3 (AS3) is giving my graphics (buttons and movieclips) outlines

So, I'm pretty much a beginner in Flash and Actionscript (using AS3, as I said in the title), and I'm trying to make a basic escape the room game. I haven't gotten far, and right now that's because every time I test my game (or publish preview it) the graphics get this annoying outline. Here it is when tested: http://i305.photobucket.com/albums/nn228/chokingondrama/flash.png
Every outline corresponds to some object present in the game, most of which have an alpha component of 0 since they're on different sides of the room. This didn't happen before, but once I added the code that allowed the player to change their view with the arrow (each viewpoint/wall is a different frame) these appeared.
It's a little different when published to HTML, basically it just gives each image a white background: http://i305.photobucket.com/albums/nn228/chokingondrama/html.png
Also, it would be nice if somebody could give me advice on how to make sure importing to flash won't result in lower quality.
Thanks in advance. If needed, I'll post any part of the code.
Some tips:
Don't set alpha to 0, instead use the visible property, setting movieclip.visible = false will make it a lot more efficient.
As for the importing and quality, after you import to stage or library, bring up the library (ctrl + l), and right click on the file you imported, go to properties. If it's an image, set compression to lossless, and allow smoothing.
For audio, go to file-> publish settings, and change audio stream and audio event (whichever you might use) to 128kbps.
As for your main question, I need more info, if you want you can post your source. It might be because of how you are placing your graphics on the stage.
For each of your MovieClips in question:
Try disabling button mode and see if the rectangles go away.
movieClipName.buttonMode = false;
If that doesn't help, or you really want button mode, try setting
movieClipName.tabEnabled = false;
There's a chance that since you added keyboard interaction each of your MovieClips are now expecting to be selected by the user when they press the tab key, much like any normal web form.
tabEnabled in the docs
You could also try
movieClipName.focusRect = false;
focusRect in the docs

How to change dynamic text in flash as3?

I'm beginner in flash. I created a text from the text_tool in flash. I set the instance name 'mytext' and text type to dynamic. Now I want to change the text on run time. For example: current text is 'hello world' now when I run the flash file I want to change the text to 'any random text'. So I used following code for this. mytext.text = 'any random text'; but on the run time I could see any text. Please help me how to change its text?
Thank you
There could be multiple reasons for that, Please check for the following:
If there are multiple frames on your timeline and your TextField is extended all over those frames then make sure you have provided the instance name to your TextField on all the KeyFrames on the timeline.
If you are using some fancy Fonts, try embedding the fonts, at times non-embedded Fonts create this problem.
for addition, you can use
your textfield.appendText();
good luck for your work :)

Taking an intro Flash/AS3 course; problems with MVC pattern

Okay, so I've been busting my hump the last week or so on this project for my OOP/AS3 course and this past Sunday I realized that my approach wasn't going to work so I scrapped the better part of it and started over.
Our assignment is to create an XML based flash menu that demonstrates an understanding of the OOP patterns we've just learned. It was kind of a 'test the waters' project where he gave us a ton of tutorials and information and told us to make our best attempt at making sense of it so I'm certain there are more efficient ways to do what I'm doing, but that's a moot point.
We need to employ at least two patterns in our menu, though at the moment I'm just focusing on MVC so that I can get the mainUI working before I finalize the second part of the UI. It essentially flows like so:
MainUI has 4 menus that slide out.
Each slider has 3 thumbnails on it.
Clicking on any of the thumbnails will move to the next part of the UI. This functionality is currently disabled.
The program runs with 0 compiler errors, but the images are not being placed on the stage correctly and I can't figure out why. All the image paths are being pulled and stored from the XML properly. The main background image is pulled once and is supposed to be only placed once (if statement that uses a count to determine whether to run the placement function or not), but it is being placed 4 times with the sliding menu image. The sliders are being placed in the correct positions (switch statement that iterates through the mainUI function in the View class and creates a separate loader for each one), but the thumbnails are not all showing up. So here is what I'm seeking help with:
The mainPanel image should only be placed once, rather than 4 times with each slider.
The sliders, while being placed correctly, must be tweened in different directions through the as (using TweenMax), but each instance is unidentifiable from the other so right now they all have an eventListener that calls the same tween method. How can I distinguish them in a way that lets me apply a different tween to each (This will likely be a concern with the thumbnail functionality later as I will need to load different XML data based on which thumb is clicked).
I have added what I hope are very informative comments to each script so hopefully people can help. Also included are images of what I want the mainUI to eventually look like and how it's coming out currently.
pastebin with all 3 classes and XML (2 hyperlink limit) - http://pastebin.com/u/crookedparadigm
top image is how the stage is outputting, bottom image is what I'd like to to be - http://imgur.com/a/bOmsS
Last quick note, stage is currently set to 600x480 with a black background. Ideally, to reinforce OOP principles, our professor wants us to avoid using the timeline or library if possible.
Any advice at all will be greatly appreciated! Thanks!
Install FlexPMD This is a very good add on( sometimes hard to install ) It basically is used to show areas of your code that you are not following standards. For example your classes lack the use of "this". And you should avoid passing parameters in constructors. It would be good practice to develop standardized writing skills while you are still new.
Looking at your code I see you are calling buildUI from within a loop.
buildUI is assigning a MainView object to mainUI.
So each time you go through a loop iteration you are reassigning mainUI.
In the end mainUI will only be the last iteration of that loop.
Not sure this is your issue but is an issue.
[EDIT]
Excellent Singleton guide for Flex SDK
Part 1
Part 2
Some Good writing on pure AS3 Singletons.
I would prolly start from scratch as your XML data is miss formatted.
your XML should resemble something like this.
<MainProject>
<MainUI>
<Thumbnail Name="Spring">
<Destination Name="Spring" Price="99" ratingPath="images/SP1/SP1rating.png" />
</Thumbnail>
<Thumbnail Name="Winter">
<Destination Name="Winter" Price="152" ratingPath="images/SP1/SP2rating.png" />
</Thumbnail>
</MainUI>
</MainProject>
Then you should have the following structure on your stage. These movieclips should be empty and already placed inside on your stage with instance name.
Stage
MenuUI MovieClip
ThumbNail1 MovieClip <- feed it thumbnail from the XML
ThumbNail2 MovieClip <- feed it thumbnail from the XML
ThumbNail3 MovieClip <- feed it thumbnail from the XML
ThumbNail4 MovieClip <- feed it thumbnail from the XML
This might be a bit too vague, just tell me if you need more details.
Hope this helps !

Unknown error AS3

Well, it's not an error, actually. I have wrote a game. There is only one keyframe on the main timeline (I don't mean one layer, there are lots of them, just like different MovieClips). Currently, I'm not using TextField anywhere, but I want to, because I need to display score on the screen. When adding TextField through Flash CS5 and naming it, when compiling, unknown window appears, you can see it on the picture. Not quite sure what it means. When clicking OK, window disappears but instead of my program there are three dots on the screen, you can see them also. I have no idea, neither of what is this, or how to fix it. Any hints? Thank you in advance :)
By the way, on one of the pictures, you can see what the game should look like. And as I said, it does, until I add some TextField to it.
it seems that you're using the TLF (text-layout-framework) in your textfield by accident.
this is a RSL (runtime shared library) that the flashplayer has to load before it can show your content. (and i think the dots are some kind of preloader that adobe puts in there ...!?)
but you don't need the TLF, you can just use a simple TextField.
select your score-textfield and choose "classic-text" in the properties window ... think that'll remove the TLF from your project. (if you have more than one TextField, check every one of them for "TLF text" and change it to classic).