or if i'm using Flash Professional, i can simply set these properties for the document in the UI.
while the Stage class offers the ability to set a frameRate and override width and height thru properties in actionscript, why is it not possible to set the background color of the stage the same way?
Stage doesn't have a property (public or otherwise) for background color. can anyone explain why that is? it seems strange to me but i'm assuming there is a good reason rather than this simply being a oversight.
i have a class .as file which extends MovieClip. inside the .as file there is a public function and when called upon it needs to change the value of a property that is on the maintimeline
Code: package { import flash.display.*[code]....
problem is this error 1119: Access of possibly undefined property gear_num through a reference with static type flash.displayisplayObjectContainer.
If I have a textfield instanciated from the document class with a base .string set as for example "4444" and BEFORE adding it to stage, I change the .string value to say "1234", when I test the swf, I can see the 4444 for a very short time changing for the 1234.I didn't change the value after adding to stage so I don't get why the display number is changed after being added to display.How to force it to add to stage (display itself) only once the initial changes to his properties are done?
I have some code that adds a child using addChild(dragsquare); dragsquare is what I used as the class for a movieclip, mcsquare.
Everytime a child is added to the stage, it is called: ObjectX The "X" increments everytime a new object is added using ++objNum.
E.g:
Object1 Object2 Object3
etc...
When the child is added to the stage, it can be dragged, resized, rotated, etc...
I have used this code so when someone clicks the "save" button it loops through all objects on stage (increasing the last number by 1 to get the next object) and finding their properties. Here is the code I have used.
ActionScript Code:
Code: save.addEventListener(MouseEvent.MOUSE_UP, saveObjects); function saveObjects(event:MouseEvent):void { for (var i:uint=0; i<numChildren-23; i++) {
[Code]....
23 children already exist on stage so I have to minus that number to get whatever is added on stage by the user.
However, scaleX is getting the childs ORIGINAL properties and not its current stage properties (where it has been resized, rotated etc..) and only returns a 1 for scaleX. How would I make it track the properties it has on stage?
I have an object on my stage, called obj.I also have a class called "Physics" which contains a bunch of methods for physics, such as inertia, gravity, and bouncing off walls. In order to do some of these,I need access to the stage.stageWidth and stageHeight properties.My code is as follows:
public function wallBounce(obj) { this.stageRef = stageRef[code]...
This is supposed to check if the object's x value is greater than the stageWidth or less than 0. When I run this code it says:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
I am a semi-newbie programmer who is completely self-taught and have no clue what is causing this. I spent a bit googling it, and I think it has something to do with scopes,.
If I have a swf that's being loaded into other peoples' swfs (which I have no control over) is there any way I can get properties from the stage (such as height, width, fullScreenHeight, etc.) or does this have to be exposed by the loading swf?
I am using this code to iterate through the contents of a movieclip which contains instances of "alien2" - my alien. I have each alien in a movieclip called squadron1. They all have their own layer and follow a motion path to recreate the attack sequence in Galaga. I can add action script to them by right clicking on them, but when I do this test below I can't call any MovieClip methods on them. It is my intention to add a function to each one via code to make it detect bullets, look for the player etc, but at the moment all I can do is add the code to each one individually on the stage.
Code: var target; for(var item in _root){ if(_root[item] instanceof MovieClip ){ target = _root[item]; [Code] .....
I am trying to access a property that belongs to the stage, from a class. For example, let's say I add a textfield with an instance name of "magic_txt" on the stage. In the Document Class, I am able to access magic_txt and update the field like so:
magic_txt.text = "Magic Text"
However, since I would like to work in classes, I am having a difficult time figuring out how to access the property "magic_txt.text" from a class. I know I need a reference, but I am unsure how to set this reference.
I am coming from a strong background in Visual Basic, and in Visual Basic, the way to access a form property is to call the form name (dot) object. In actionscript, it doesn't seem to be as simple.
is there a way to override a MovieClip's parent and stage properties? In a custom class extending the MovieClip class we can override the get parent() and get stage() methods. But is there a way to do it to existing MovieClip?
I mean I have an external swf content (loaded) and assigned to a movieClip. But now, how can I assign the loaded MovieClip to my custom class, so that it "doesn't see" the parent and stage properties?
Or can I override functions of existing classes? Sth like:
override public function myMovieClip["get parent"]():DisplayObjectContainer { ... }
I just need to prevent a loaded MovieClip from having access to the main movie's stage.
How do I access Stage Class properties in Custom Class? Class: package { import Main; import flash.events.*; import flash.display.Sprite; import flash.display.Stage; public class Run extends Sprite { [Code] ....
Output: TypeError: Error #1009: Cannot access a property or method of a null object reference.
I have made a very simple swf in which I have a MovieClip which I have rotated on the stage. When I try to access this rotationX and rotationY properties of this clip using the constructor of the class assigned to this MovieClip they are coming back as 0 even though they shouldn't be. If I put an on rollover event of the MovieClip and trace out these properties here I get the correct values.
1) In my program, I am wanting to create a function that would take in the height and width of a loader object, compare them to the stage dimensions, and then scale the object in question before it is added to the display list. However, I have several different types of classes that I want to make use of this functionality. So what would be better, to create a NEW class that would have to be created each time a resize needed to occur, and is imported by all needed classes, or just have a function within each already existing object and copy that function to every class's scope that needs it? Would this be resolved by placing the function in question inside of the default package?
2) When accessing stage properties, are they a global or a relative scope? i.e.[code]would those two statements produce the same value regardless of whether they were in the default package or inside of 1300 classes? Or is the stage scope relative to some degree?
how to set the scrollpane's background color in AS3 with CS4?You can't seem to use _Globals, setStyle,and opaqueBackground doesn't seem to work effectively.
I've already tried a lot, but there was no way I could change the color of my textInput. Adobe Livedocs couldn't help me and there was no working piece of code I could find in other messageboards.
That's really all I want to do. Why is something like this so complicated? When you go into Component edit mode, you can easily change the highlight colors. Then why make it impossible to change the actual ground color? Why should I have to scour the internet to find complex code just to change the color? Sorry, it's just frustrating.Anyway, if setStyle("backgroundColor", 0xCCCCCC); ... was all I needed to do that would be fine, but that doesn't work.Even if it's not possible, I would accept text rollOverColor, or hover... nothing.I think there should be a drop down color box in the component editing window at the very lest.
I have a Flex 4.5 mobile app, I'm trying to set the backgroundColor to black, aka 0x000000 at runtime.It won't go black, in fact, it will go any other color but black.[code]Just as some extra info, I have my original Application backgroundColor #333333 set in a .css file and in the MXML Application node.
I searched and didn't find quite the right solution. Please bare with me as I am a complete infant with this.Using a component listbox in CS4. I have figured out how to call in formatting to the text by using this:Code: Select allimport fl.managers.StyleManager; var tf:TextFormat = new TextFormat(); at the head, and referring to it below, with:
I have a textinput component that needs to have a transparent background. I've tried adjusting the alpha to 0% and 25%, the former doesn't display the contents (white font bold sans-serif) and the latter leaves a shaded background. I've also tried the following:
var tf:TextFormat = new TextFormat; tf.color=0xFFFFFF; tf.font="Sans-serif"; tf.size=12; tf.bold=true; txtlowtemp.setStyle("textFormat",tf); txtlowtemp.backgroundColor=undefined; txthitemp.setStyle("textFormat",tf);
I have a textinput component that needs to have a transparent background. I've tried adjusting the alpha to 0% and 25%, the former doesn't display the contents (white font bold sans-serif) and the latter leaves a shaded background. I've also tried the following:
var tf:TextFormat = new TextFormat; tf.color=0xFFFFFF; tf.font="Sans-serif"; tf.size=12; tf.bold=true; txtlowtemp.setStyle("textFormat",tf); txtlowtemp.backgroundColor=undefined; txthitemp.setStyle("textFormat",tf); txthitemp.backgroundColor=undefined;
However, this gives error 1119 access to possibly undefined property backgroundColor.
How can I create a truly transparent background for these components?
Im trying to change the background color on my textarea from an external css.I can change the color of the buttons so the style sheet is working. But I cant seem to ad the class into the text area.[code]...