Jump to content
  • Advertisement
Sign in to follow this  
Serendipity

Another Simple Flash Question

This topic is 3033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm still working my way through Foundation Game Design with Flash. I've typed in another example as written and I'm getting yet another error message: 1046:Type was not found or was not a compile-time constant: TextFiled Source { Followed by the same error with the source import flash.display.MovieClip; The text for the input and output fields is also not showing. Any help would be appreciated. Here's my code: package { import flash.display.MovieClip; import flash.events.MouseEvent; public class Main extends MovieClip { var startMessage:String; var mysteryNumber:uint; public function Main() { init(); } function init():void { startMessage = "I am thinking of a number between 1 and 100"; mysteryNumber = 50; output.text = startMessage; input.text = ""; } } }

Share this post


Link to post
Share on other sites
Advertisement
I also think something is wrong with input and output.

Some question:

1) Where are you developing this? Flex IDE? Flash IDE?


Assuming it is Flash IDE:

2) There should be 2 TextFields on the stage. One with instance name "output" and the other "input". If this is correct then try Lostvoices advice and add stage before input and output.

In pure AS3 using Flex Builder the following code works fine:



package {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

public class Main extends MovieClip
{
public function Main()
{
var startMessage:String;
var mysteryNumber:uint;

var input:TextField = new TextField();
var output:TextField = new TextField();

input.autoSize = TextFieldAutoSize.LEFT;
output.autoSize = TextFieldAutoSize.LEFT;

addChild(input);
addChild(output);

startMessage = "I am thinking of a number between 1 and 100";
mysteryNumber = 50;

output.text = startMessage;
input.text = "";
}
}
}




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!