Create text fields in Flash CS5 - actionscript-3

Im probably some 4 hours old working with flash CS5, and im trying to create a website that just displays a goggle map with two text fields that the user would enter some details(its for demo purposes), Have no issue with the google Map Part, but i have probably the dumbest Question ever, how do i create a textfield in flash. Or am i using the wrong tool for the task?
Thank You

If you are trying to do so via AS3, it's really simple. Given some parent clip you'd like the textfield to be placed into
var tfTextfieldName:TextField = new TextField();
tfTextfieldName.type = TextFieldType.INPUT;
tfTextfieldName.border = true;
tfTextfieldName.x = 10;
tfTextfieldName.y = 10;
tfTextfieldName.multiline = true;
tfTextfieldName.wordWrap = true;
parentClip.addChild(tfTextfieldName);
I took this straight from the Adobe doc page for the Textfield Class. There you'll all the events/properties available.

Related

How do I make a text box in ActionScript 3?

I'm trying to learn ActionScript 3, but right now I'm hung up on getting a basic interface set up. I've found out that newTextField will make one, but I don't know how to put it where I want.
I've checked out some source code for other projects using the same IDE (Adobe Flash CS6) and they seem to have access to a textbox symbol. So how do I make one of the textbox symbols with the IDE, or using some code?
var tf:TextField = new TextField;
tf.text = "Hello World!";
addChild(tf);
These will create black text reading 'Hello World!'.
Find out more about text fields here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html

Flash Builder Not Recognizing Keyboard Input In A TextField

This is really very bizarre and I've wasted too much time on this - the following code works in a .fla perfectly (Flash Pro project), but when I try and use it in my ActionScript Project compiled with Flash Builder the input textfield doesn't recognize or display the new text. Even setting up eventhandlers to track the change do not work. I can use this.tf.text = 'blah' and it will work, but it will not accept user input.
this.tf = new TextField();
this.tf.x = 100;
this.tf.y = 100;
this.tf.width = 100;
this.tf.height = 20;
this.tf.type = TextFieldType.INPUT;
this.tf.restrict = null;
this.addChild(this.tf);
Has anyone come across this before? I've uninstalled Flash Builder Pro and reinstalled it, too.

Browsers cut off query strings sent from Flash

I need to send a query string from Flash so that it appears in address bar of a browser. Basically, I need to make a Flash version of this HTML code:
link
Seems simple... When I try to do this from Flash the browser cuts off the query string. So instead of getting Portfolio.htm?image=4, I only get Portfolio.htm This is the actionscript I am using:
var url:String = "Portfolio.htm";
var variables:URLVariables = new URLVariables();
variables.image = '4';
var newRequest:URLRequest = new URLRequest(url);
newRequest.data = variables;
newRequest.method = URLRequestMethod.POST;
navigateToURL(newRequest);
This actionscript works great when I click the button from the Flash player. It stops working when I try to put the swf into a HTML wrapper.
The query string image=4 is not going to PHP file. Portfolio.htm uses Javascript to strip the variable from the URL. Most of the questions surrounding this topic deal with PHP files and don't care if the query string appears in the browser address bar.
Try changing the URLRequestMethod to GET instead of POST.
newRequest.method = URLRequestMethod.GET;
Or simply leave it out because GET is the default method.

Trouble using Loader, can't access properties of loaded swf

May not have asked question correctly so I’m asking again. I’m using Flash AS3 with code in actions layer.
Main movieclip onstage is : design_mc. Within it is a movieclip already in place onstage with an instance name clipart_mc.
Now I’m also loading a ListBox to the stage and each time a selection is made from listbox myLoader9 is used to load selected .swf into design_mc.clipArt_mc.
Now within each of the .swf files loaded into design_mc.clipArt_mc there is a mc I’d like to color transform called color_mc.
So now the listbox is onstage and I make a selection that places heart.swf inside of design_mc.clipArt_mc. I want to access heart.swf so I did this:
var child:DisplayObject = myLoader9.content.contentLoaderInfo.content.color_mc;
var colorTrans3:ColorTransform = new ColorTransform();
var trans3:Transform = new Transform(child);
I still can not get to heart.swf. Can anyone help please?
Anne
I'm working with Embedded SWFs here, but I think it's the same. I can get my MovieClip from the Loader "content" property. Like this:
var myMC:MovieClip = MovieClip(myLoader9.content);
Try this way, instead of using "content.contentLoaderInfo.content".
:)
I got it. I gave the loader a name:
myLoader9.name = "currentClip";
Then I can target in main movie using:
var child:DisplayObject = MovieClip(parent).design_mc.clipArt_mc.getChildByName("currentClip").content.color_mc;

scrollbar in flash CS4

I am trying to put a vertical scrollbar onto a dynamic TextField in Flash CS4. When I do this in Scene 1, everything works just fine. However, if I move the TextField+Scrollbar to Scene 2, it breaks. The errors I get when I run the code indicate that Flash is loading the scrollbar right away and then trying to find the associated TextField. The problem is that, since the TextField doesn't load until you get to Scene 2, Flash throws an error.
I tried a lot of things to solve this issue. What it mostly came down to was that I needed to create the TextField and Scrollbar in actionscript (instead of from the component library) so that I could control when each was created. To create the TextField, I typed:
//create a textfield for the story
import flash.text.TextField;
var story_txt:TextField = new TextField();
//story_txt.multiline = true;
story_txt.x = 154;
story_txt.y = 233.5;
story_txt.width = 348;
story_txt.height = 104.5;
story_txt.border = true;
story_txt.type = "dynamic";
story_txt.backgroundColor = 0xffffff;
story_txt.background = true;
story_txt.wordWrap = true;
story_txt.multiline = true;
and to create the scrollbar, I then typed:
import fl.controls.UIScrollBar;
//add the story_txt to the stage
addChild(story_txt);
var mySb:UIScrollBar = new UIScrollBar();
mySb.direction = "vertical";
// Size it to match the text field.
mySb.setSize(story_txt.width, story_txt.height);
// Move it immediately to the right of the text field.
mySb.move(story_txt.x, story_txt.height + story_txt.y);
// put them on the Stage
mySb.scrollTarget = story_txt;
//mySb.scrollTargetName = "story_txt";
stage.addChild(mySb);
The only problem is that this code only works if I make the ScrollBar horizontal and turn off wordwrap. For some reason, the vertical scrollbar will not work with wordrap on (and w/o wordwrap, Flash thinks that there's no need for a vertical scrollbar, as it sees only a single line of text.
Getting a textfield w/a scrollbar should be a simple process, but this is really out of hand. Any ideas on how to get the ScrollBar to work when wordWrap is turned on?
Basically you should never use Scenes in Flash. There are a lot of known issues with them.
This thread might help.
Scene usage is generally bad practice. They are a legacy feature left in to keep current versions of flash compatible with earlier versions. If you must use the IDE to place things on stage you should use distinct frames on the main timeline in place of scenes, and place things that need the timeline to animate inside their own movieclips. The flash IDE actually reduces all the scenes down to one timeline at compile time any way but with many anomalies that wouldn't be present in manual timeline manipulation.
disadvantages of scenes from adobe: http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSd60f23110762d6b883b18f10cb1fe1af6-7eb3a.html