ActionScript 3.0 :: Cast Displayobject To Dynamic Text?
Sep 2, 2011I am trying to take a displayobject of a dynamic text which is retrieved with getChildByName and cast it so I can access the .text property of the object.
View 5 RepliesI am trying to take a displayobject of a dynamic text which is retrieved with getChildByName and cast it so I can access the .text property of the object.
View 5 RepliesIs it possible to Cast the DisplayObject into MediaElement.Am trying to add the DisplayObject into the MediaContainer, but I got the following error:
-1067: Implicit coercion of a value of type flash.display:Loader to an unrelated type org.osmf.media:MediaElement.
-mediaContainer
_loader is the variable of DisplayObject.
mediaContainer.addMediaElement(_loader);
I am using Flash Builder4.
i have a mediacontainer,i want to add the displayObject into the MediaConitainer.I dunno how to Cast the object into mediaContainer?
[Code]...
I tried this:
(DisplayObject(slider)).parent.addEventListener(CustomEvent.CUSTOM_EVENT_TYPE, onCustomEventType);
but flash doesn't like
For whole context see Why Flash doesn't recognize this parent property ? How to get the parent which instantiated an object ?
I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.
[Code]...
i have a problem with the line space flash creates when a dynamic text is loaded in a dynamic text field on the stage i put a dynamic textFild with istance name "profile_text". then im loadin in it a text. my text is written in the Notepad like this
[Code]...
i already set a Textformat to my dynamic text with i tryied to play with the "Leading".. but i think it something dealing with paragraph. how i can decrease spacing between paragraphs??
All I want to do is add text from my string to dynamic text field when I click dynamic buttons. What should the as code be for this? Here is my code. Right now I just have the click returning another shape.
[Code]....
I want to have a loader function that passes the loaded data to the correct function. So I can do this:[code]Is there any way to type the second variable to avoid the clumsy switch routine, like so:Function (sendTo) ();
View 2 RepliesAs far as I know theres in no way to cahnge the alpha of a dynamic text box. I put one in a movie clip and when i try to change the alpha of it everything else in it changes its alpha but the not the DT box. Could someone plz verify for me that u can't change alpha and help me find a component that allows alpha control with a dynamic text box. thx in advance.
View 5 RepliesI have the code the following code:
in root frame I:
var prevSec:*;
var currentSec:*;
var lastPage:String = "Default/Index";
[Code]....
And it's not working ("canno't create property visible on String"). I understand that if finds the variable to be of String type.
What i need to do is based on the switch to set a certain movieclip to go visible false or true on frame 16. I need to know how to cast the String into MovieClip.
Does anyone know how to cast a string into a uint?[code]...
But i keep getting an error stating that there is a mismatch in variable types or i get a value of '65280' when I trace myUint.I understand that uint is a positive integer but i need to accept a string for the colour value and need to convert it to a string for use.
i have a list of items that get returned from a database. the list is composed of strings. what i need to do is convert each item into a variable so that i can use each item as an array.
for instance, my array will look something like this: deviceArray = ["osx106", "osx107", "winxp", "win7"];
what i want to do is turn each item into its own array. in AS2 (iirc) we had an eval() method. that is no longer supported in AS3.
I need ActionScript Proxy to be castable to a particular interface.
Here is an example without interface:
public dynamic class Tracer extends Proxy {
flash_proxy override function callProperty(method:*, ... args):* {
trace(method + " " + args)
}
}
[Code]...
I have 5 different arrays for a bunch of excercises, like so:
const oef1:Array = ["citroen","schoen","boek"];
const oef2:Array = ["huis","muis","jas"];
const oef3:Array = ["boek","koek","sok"];
const oef4:Array = ["ei","bij","bot"];
const oef5:Array = ["vier","mier","muur"];
Now I want to set the current game. I do this by copying the array, like so:
var curArr:Array;
var curExc:int = 1;
curArr = ("oef" + curExc) as Array;
I can't convince flash to accept the string ("oef"+curExc) as an Array. How do I do this?
I have searched Stack Overflow extensively but I think I simply don't know the correct lingo for what I'm looking for. It's the only possible reason I can think of why I can't find the answer here because I'm sure someone must have already tried this.
I have a variable in flash:[code]I then have a multidimensional array which has this variable name in it, but as a string.[code]What I need to do is be able to reference the string item in the array, but then cast it so that when I add a number to it the ACTUAL variable with the same name will be altered - anyone know how I can do this?For reasons I won't go into I can't pass it straight into the variable, it has to go through the multidimensional array item.
View 5 RepliesI have 52 symbols in my library each with class names Symbol1, Symbol2, Symbol3, etc. I want to create an array of these classes which will be used to create a random particle effect. How do I cast the var cardNumbers so that the array looks like this[code]...
View 1 Repliesi have an array of Sprites object reference
Code: Select allvar clipps:Sprite = new Sprite();
bildArray[i] =clipps;
And later in the code i want to get the x position of the sprite in the array-
Code: Select allTweener.addTween(bildArray[i], {x:(bildArray[i].x +50), time:3, transition:"linear"});
dose not worke so i need to cast it to Sprite?so i do
Code: Select allvar v:Sprite = bildArray[i] as Sprite;
Tweener.addTween(bildArray[i], {x:(v.x +50), time:3, transition:"linear"});
But it dose not work, what do i do wrong?
I have successfully imported a Lightwave generated Collada file into Flash using Papervision3dA material within the Lightwave file is called "Lambert4SG". How can I assign the "precise" property to eliminate the texture distortion. However, the material needs to be cast to BitmapMaterial in order set a BitmapMaterial specific property.
View 2 RepliesI need to add values in a string (they're strings because I get a date as timestamp from a database and then pluck it apart in Flash with substring). Flash doesn't do math with strings. So is there a way to cast the string into an integer value?
View 4 RepliesI'm relatively new to Actionscript, in fact, I just figured out today how to load text from an external source. I have another issue that I'm not sure how to handle. I have buttons for my main nav, a main text box, and a mini text box (both text boxes are loaded dynamically from external files). I want to have the mini text box load new external text files in the main text box. For instance, I have a button for music, which loads a list of songs in the mini text box. I want to be able to click on the name of one of the songs and have it load the lyrics in the main text box. I'm sure it's simple, I'm just new.
View 3 RepliesI have another issue that I'm not sure how to handle. I have buttons for my main nav, a main text box, and a mini text box (both text boxes are loaded dynamically from external files). I want to have the mini text box load new external text files in the main text box. For instance, I have a button for music, which loads a list of songs in the mini text box. I want to be able to click on the name of one of the songs and have it load the lyrics in the main text box.
View 3 RepliesProblem: I am trying to get a very simple text resize going, for my main content area in a flash website. My aim is to get a button, that on click, increases the text size of a dynamic text field.
[Code]....
This is what I tried, I am very new to Action Script, so excuse the futility of my code.
In my app i am pushing data into an array collection. When I debug or trace the AC i get [object Object].
public var newsDB:ArrayCollection = new ArrayCollection;
then I add to the AC here.
if(archive.selected == true){
newsDB.addItem( {
title: titleText.label,
clickURL: clickURL.text,
[Code]....
When I debug, i can see that the items are in the AC, but as generic objects.
Can someone explain me why when I listen for a custom event and then redispath it it is redispatched as an Event instead of an object of custom event type ?
Exemple : You make un custom event, name it CustomEvent.
In a first class you dispatch an instance of this event and it is managed by a method in a second class, let's say this one :
[Code]...
I missed probably something in event dispatching process but I don't know what. However I found a solution : In the first event manager, dispatch a copy of the custom event received instead of dispatching the object itself. It works in this case.
Here's the example:
var cartesian:CartesianChart = new CartesianChart();
cartesian.width = 100;
var column:ColumnChart = new ColumnChart();
column = cartesian as ColumnChart;
Why does this not work? "column" ends up null. ColumnChart is a derived class of CartesianChart, so I would have thought I'd end up with a ColumnChart with a width of 100.
Is it possible to cast a variable as a type dynamically, where the type would be a variable of type Class? Consider the following (invalid):
var myClass:Class = MyClass;
var myInstance:myClass = new myClass();
For context: I'm working in Flex (4) to create a modal manager that will control various aspects of creating modals (via PopUpManager) and I'd like to keep it as minimal as possible. Components would be passed through the same functions, and rather than allowing any type of variable to be cast, eg:
[Code]...
i'm trying to modify a image, which is casted from a String:[code]In the inactiveElements Array are a bunch of ImageIds (way_0, way_1,..) and i'm trying to set the alpha-value of each Image.[code]with the trace i got the right String of ImageId but the cast to Image fails.[code]
View 1 Replies[code]How to set focus to class1_txt?I've tried this, but doesnt work. How to type cast it so that the focus goes to the class1_txt.[code]
View 5 RepliesI have a problem in dispatching a customEvent. I already managed to dispatch custom events in other projects and all worked well so i can't understand what's different now. I have a WSConnectorEvent that extends Event
[Code]...
I'm trying to load a external swf using the Loader object, and that part seems to be working fine. But, I can't seem to be able to cast the LoaderInfo.content to a interface that it's document class implements. This should be possible, shouldn't it?
Code:
public function load()
{
[code].....