flash 5?
- Started
- Last post
- 19 Responses
- kld
I need to center a MC in the main stage dynamically. within the MC will be a static graphic(to the right of the text box) and a dynamic text box that is flush left and a fixed distance to the graphic. The dynamic text box will be different lengths depending on the text that is loaded.
all this is happening in a swf saved out for flash 5 player.
Is there a simple actionscript that will center the MC regardless of its width after the dynamic text is loaded?
thanks in advance
- JazX0
Flash Player 2 : First version with any scripting support. Actions included gotoAndPlay, gotoAndStop, nextFrame and nextScene.
Flash Player 3 : Expanded basic script support with the ability to load external SWFs (loadMovie).
Flash Player 4 : First player with a full scripting implementation (called Actions). The scripting was based on a slash based syntax and contained support for loops, conditionals, variables and other basic language constructs.
Flash Player 5 : Included first version of ActionScript. This was a prototype based-language based on ECMAScript (http://www.ecma-international.o... and allowed full procedural and object oriented programing.
Flash Player 6 : Added an event handling model, and support for switch.
Flash Player 7 : The compiler in the corresponding release of the Flash authoring tool, Flash MX 2004 (http://www.macromedia.com/softw... supported ActionScript 2.0 which syntactically was a more class-based language. However, it compiled down to ActionScript 1.0 byte code, which could be run by existing Players dating back to Flash Player 6. Flash Player 7 offered some new features such as CSS text and performance improvements. The new object-oriented features of ActionScript 2.0 are based on the ECMAScript 4 Netscape Proposal (http://www.mozilla.org/js/langu...
- kld0
thanks for the history JazX.
Nobody has a recommendation for this particular scenario?
- JazX0
I just thought you might want to know that, some AS dudn't work in Flash 5. I learned the hard way recently. :(
- kld0
yep, I'm aware of that. That's why I made it clear that this was to be saved for a flash 5 player. Thanks though.
- kld0
OK, can anyone tell me how to center align a MC on the main stage at runtime regardless of flash player version.
please excuse my actionscript nOObhood. Thanks! I've been googling and actionscript.org-ing this and I can't seem to find anything
- fusionpixel0
you must likely will have to use a dummy MC and then reference all your objects to that MC.
- kld0
ummm, ok, so load into a empty MC?
- fusionpixel0
that is correct, you can even set the visibility to false of the MC you are using as a reference. Or set the opacity to 0. either way it works.
- kld0
cool, thanks. Now if, say, the dynamic text was differnet lenghts would it still center itself in the main stage based on this empty MC being centered?
- TrueHell0
MC._x = Stage.width/2;
MC._y = Stage.height/2;
set the resitration point in the MC to where you want it to land on the middle. This will position the clip at publishing and you can set it to check if the size of your movie changes as well. not sure if it is kosher in 5 though. seems like it should be.
- kld0
Hell Yeah! Thanks i'll give it a go.
- caseyc0
TextField didnt come into it's own until flash 6, when it got properties, instance names etc.
The only reliable way to measure I can think of is to do it "by hand" meaning that you would need to type all of your characters in the font and size your using and get a pixel width for each. Then you could dump those values into an object and loop over it adding each character until you got an estimated width. Something like this...
http://pastebin.coconut.se/?id=4…
Good luck, btw why flash 5?
- caseyc0
Stage class
Availability
Flash Player 6.Not kosher :(
- caseyc0
Shite, just realized that my code example wont work fully due to case-insensitivity in flash 5/6, you'll need something in there to check case and also a second object for lowercase letters.
Once again, why flash 5?
:)
- kld0
Caseyc, I ask my self why everyday I come to work. The company I work for has flash/activeX based networks installed in many supermarkets.
When the first stores were installed back in the day flash 5 was it. There are no plans on updating the flash players in the field due to hardware/cost limitations. thanks very much for the suggestions/code.
- caseyc0
I feel your pain, see Employment Opportunites in the NTB.
Good luck!
- kld0
thanks casey, I'm looking everyday. ; )
this was supposed to be a 2 month contract, I've been here 14 months.
- fusionpixel0
at least you have a place to work, lots of people would give anything to have a chance to work on flash all day long even if it is V5.
:)
btw, i dont have that problem but i am sure some one out there is doing something that has nothing to do with flash or graphics and has the talent to do it
- kld0
Definitely not complaining about be employed, and my contractor rate is good. Just would like to be at a studio or agency more than inhouse.
And flash is really only a small part of what i do. Alot of concepting, storyboarding, after effects, etc.
Seems like alot of job ops lately for flash peeps so good luck to all who are looking.