ActionScript 3.0 :: Targeting A Component In A Class?
Sep 1, 2011
I want to load a swf into a byte array before loading it into an swf loader. I'm wondering how I would target a specific swf loader to do this to since I have 3 different ones.
View 1 Replies
Similar Posts:
Aug 22, 2008
This question specifically deals with AS3 and list components and styling a selected item, if that's even possible. I've got an XML/Flash Video player that lists the videos with a thumbnail and description in a list component. I got the source files from an Adobe tutorial:[URL]...I'm able to style everything the way I want it. The problem comes when I try to attribute a specific text style to a selected item. I understand how the information is being taken from the XML and looped into the list component. What I don't get is how you reference a particular item in the list and whether or not you can attribute a different style to that item when the event listener fires.
[Code]...
View 3 Replies
Oct 24, 2009
I'm trying to get my own buttons to load FLV movies into the FLVplayback component. I've got it to work in a simple test but making it work on a more complex level. The test is here I've named the FLVplayback instance 'my_video'The simple buttons have this script in the actions:
n (release) {
my_video.load("videonamehere.flv");
my_video.autoPlay=true;
[code].....
View 1 Replies
Mar 3, 2010
how to target MovieClips from a class. If I have a MovieClip on the stage named recMc and I want to manipulate it using a class, I know that if I attach my class in the Document Class field in my .fla file and then just do something like this... it works
- class and fla are in the same folder -
Code:
package {
import flash.display.*;
import flash.events.*;
[Code]....
how to target this object without attaching the class to the Document class?
View 4 Replies
Feb 13, 2010
I'm trying to access a text field from what I believe is called a sub-class. The text field is defined in the .fla file and the .fla file is set up to use Main.as as its document class.I got three files; scrollText.fla, Main.as and TextUtils.as.I know most of the code is working as I programmed it all in Main.as first, but when I moved the code to target the text field into its own class file I ran into error "1120: Access of undefined property" although I have declared the variable correctly and early enough to be used at this point in my code.This is the code I got so far:Main.as
Actionscript Code:
package{ import flash.display.Sprite; import TextUtils; public class Main extends Sprite public function Main()
[code].....
View 5 Replies
Jul 23, 2009
I use the loader class to load in an external swf, a preloader movie in my class. (not a document class)
To target the properties in the swf (specifically the text field in it), I coerce it to a movie clip after it's loaded and add the child with:
var thumbPreloaderMC:MovieClip=evt.target.content as MovieClip;
now I can use:
thumbPreloaderMC.preload_text.text "sometext";
to reach the text field. works.
But, I want to nest that clip in a container movieclip I'm placing all the thumbnails I'm loading in, thumbContainer.
So I create the movieclip thumbContainer, add the child, then add the preloader swf to this clip.
I can't name the loaded swf, it throws an error, I googled that and see I can't name an already named clip.
I get an error "TypeError: Error #1010: A term is undefined and has no properties."
First of all, I'm fairly green with as3 still, I think perhaps I should rethink how I'm structuring this. I could and would ask how to target a nested loaded swf from a class.
is nesting clips like this from a class bad practice? What are best practices when it comes to using timeline based animations like preloaders etc by a class? I'd like to make my class as reusable as possible, but one can't create all animations and graphics from code.
View 1 Replies
Feb 9, 2011
I am trying to code a flash app entirely in the document class. I am using GestureWorks with a touch screen. When a user essentially presses a button it calls a method that should hide a specific graphic but not the graphic they touched.
Essentially I need a way to refer to a graphic on the screen using a method besides 'e.target'.
I am receiving this error: Error #1009: Cannot access a property or method of a null object reference.
[Code]...
It can access photo1Sprite as 'e.target' when the button click happens on the photo1Sprite. The problem happens when to click one button (not photo1Sprite) and have it effect photo1Sprite. So I can make photo1Sprite react if my method is attached to it directly using 'e.target' but not if I am trying to call it from a method that was called from another element on the screen.
View 1 Replies
Aug 26, 2010
i created One Static Class. This class used to Trim, TrimFront, TrimBack, Replace in string.How can i convert this class to component?
View 2 Replies
Jul 27, 2009
I have a class with a method name, and now I have a Flex MXML... how would I call the id of the component in my ActionScript class...
View 1 Replies
Jan 11, 2006
i'm looking for a way to add an instance to a component from a class...Something like
Code:
class myClass extends MovieClip{
function myClass(){
}
[code]....
but i dont know about the "thecomponent" part.. i tried "textInput" but it doesn't work..
View 8 Replies
Mar 12, 2006
I cannot use the PopUpManager class.
[Code]...
View 1 Replies
May 27, 2009
Our software team has been developing flash applications using AS3 (via the FlashDevelop IDE and the free Flex SDK). Recently, some members of the team started exploring FlexBuilder and Flex (wow... why did we wait so long?). The problem is that some folks continue to develop using pure Action Script 3 (FlashDevelop) while others are creating custom components in FlexBuilder. How do the AS3 developers use the Flex Custom components built in FlexBuilder in their AS3 Applications?
View 7 Replies
Sep 5, 2009
I have several components where I want to enable buttons based on passing a username to a function. I want to dynamically bind the "enabled" property on a button so that if the "somethingChanged" event fires, a button may become enabled or disabled. But, I'm not sure where to fire the "somethingChanged" event. It's possible that I may need to fire the "somethingChanged" event from several places in the application. Is this possible with a bound static function?
EventManager.as
public class EventManager():void {
[Bindable(event="somethingChanged")]
public static function hasAccess(myVal:String):Boolean {
}}
[Code] .....
View 1 Replies
Jul 14, 2009
Does anyone know how to use the PrintJob Class to print a dataGrid component in ActionScript 3 (AS3)?
I need to allow the user to sort the list and print the results.
This is being used for a school, the parents can sort the students by class and then print a class list.
View 0 Replies
Jul 29, 2009
(Actionscript 2 btw - and actually cs4, not that it really makes any difference?) I have a class that instantiates a movieclip from the library, e.g.:
Code:
debugbar:MovieClip = thing.AttachMovie("debugbar", "debugbar_mc", 999);
So attaching it to the where ever "thing" is - could be movie clip or level0 or whatever, doesn't matter as "debugbar" is a private variable of the class. Now the important part - debugbar in the library is a movieclip that contains some components - buttons and textInputs. The problem comes when trying to access these components.
I would have thought that this would work:
Code:
debugbar.input_txt.text = "hello";
In order to set the text of "input_txt", the instance name of a TextInput component on the timeline of the movie clip (put there in author time). However, this does not work. Infact, I cannot access any specific "component" properties - they come back undefined. I can however set and retrieve MovieClip properties for the "input_txt", such as _x. However there is one added strange thing with this too - setting _visible to false doesn't seem to work (however perhaps a component by default overrides this).
I also appear not to be able to add event handlers to the component - at least for the usual component events. I tried casting it to a component, such as:
Code:
var temp:TextInput = TextInput(debugbar.input_txt);
trace(temp);
which gave "temp" as null.
However if you trace the thing itself without casting to what it is, it gives the path to correctly. It almost seems like the components are somehow broken when trying to access them this way - or that they cannot be accessed this way?
The thing is, I was able to access all of this before, when the code to do it was placed on the timeline (frame 1, the only frame) of the debugbar itself, where the components were child instances. This meant I could just reference them directly too - so input_txt rather than debugbar.input_txt , although that is probably largely irrelevant. I need to have it in a class though, as I need to pass in certain objects that need to be accessed by the mc.
View 2 Replies
Oct 19, 2011
I've never extended a component class in AS2, and I'm having problems with it now.
Here's my class file:
Actionscript Code:
import mx.video.FLVPlayback;import mx.video.*;class AkamaiFLVPlayback extends FLVPlayback{
public function AkamaiFLVPlayback(){
super()}}
Here's how I'm trying to instantiate it from the FLA:
Actionscript Code:
import AkamaiFLVPlaybackvar g = new AkamaiFLVPlayback()this.attachMovie(g,myVid,1)g.contentPath = "[URL]"
Now this does not work at all. I can see that the super class FLVPlayback is creating variables, but it's not loading to the stage or initializing.
View 1 Replies
Nov 25, 2009
Is is possible to bind class properties to mxml components ? E.g.: I have a class A.as with a String property nameValue. What I want to achieve is always having the latest value of a mx:Text component in nameValue.
View 2 Replies
May 22, 2010
I'm trying to set the height of a vertical bar (activityBar) but it does not appear to do anything. i have tried something similar with the whole component, but setting the dimensions does nothing (even in the mxml used to instantiate the class). Indeed, I've added transparent graphics just to give the component some dimensions
FYI: I'm trying to create a mic activity bar that will respond to the mic by simply setting the height of the activityBar child (which seems to me to be more efficient than redrawing the graphics each time).
package components {
import mx.core.UIComponent;
public class MicActivityBar extends UIComponent {
public var activityBar:UIComponent;
[code]....
View 1 Replies
Oct 5, 2011
how to properly setup binding between my Locale class and an mxml file.
My main mxml file contains:
<mx:Button id="TMP" label="{Locale.getLocaleString('title'}"/>
I would like to display an empty string in the button's label until the locale file loads. Once the locale file loads I would like to display what is returned by getLocaleString('title').
I think that this is what Binding is intended for however I think that I am approaching it wrong.
I know that I am not allowed to bind on a function. So do I need to allow access (using a get function) to my _dictionary property? What is the standard way to setup Binding for something like this?
This is my current Locale class.
public class Locale {
private static var _dictionary:Dictionary = new Dictionary();
public static function loadResources():void {...}
[Code].....
View 1 Replies
Dec 20, 2011
Is it possible to access a declared component as an IFactory within an MXML class? I've used this style of declaring factories many times for Skin Parts, but I've never figured out how to access those factories from within the MXML.
Here's an example of what I would expect to work:
<fx:Declarations>
<fx:Component id="labelDisplay">
<s:Label fontSize="12" fontWeight="bold"/>
[Code].....
View 2 Replies
Feb 12, 2012
I have class name : some.path.exampleclass and have to instantiate class (like getDefinitionByName()). Problem is that getDefinitionByName() makes class exampleclass and i need class with FULL name : some.path.exampleclass to pass it to custom component [url]...
View 1 Replies
Oct 17, 2003
I am trying to build a component based on a class where when you enter a label at design time (in the properties panel), it displays on the component on the stage. This is done in all the FUI Components that have labels and I was wondering if any one knows which part of the code does this.
View 6 Replies
Oct 20, 2005
I'm building an all Flash site, and trying to streamline my approach as much as possible. In the site, I have 3 main panes. Navigation, ContentText, and Slideshow.
I want to keep each of these areas self contained, and just call methods to make things happen. Something along these lines: slideshow.showImage, or navigation.loadData("nav.xml") or contentText.loadTextfile("about.txt").
I could make each pane a componant, or a movieClip with methods defined on the first frame, or perhaps I could use classes. I was hoping the more experienced people here might have some advice on what is the best approach to take.
View 8 Replies
May 14, 2007
I have an as3 component I made in CS3 and need to access the Component Definitions. Defining component parameters using the Inspectable Tag metod does not return success.
View 1 Replies
Jun 23, 2011
I have a component "child" which has a cancel button. Now this component is placed in a state called "newChildComp" I also have another component called "parent". In the parent component, i have a button that dispatches an event. Here is the event code:
[Code].....
so, basically,i am checking to see if the cancel button component in the Child component, while i am still in the parent Compoent, was clicked, if it was clicked, call the cancelButtonHandler. The problem is by the time the addNewChild handles the event, that cancel button was still null. My question is how do i solve this without using the itemCreationPolicy on the cancel button?
View 1 Replies
May 14, 2010
I would like to know if it is the same to assign properties to my custom component in its own class, or from the parent document. Here I assign the property bottom in my custom component class:
<?xml version="1.0"?>
<mx:LinkButton bottom="20" >
<mx:Script>
Here I assign the property bottom when I use the component in my main MXML file
<myComp:Brick bottom="10"/>
View 2 Replies
Jan 23, 2011
I was wondering how I apply an edited actionscript class to a component?
I've made a few changes to the TileLayout class (spark.layout.supportClasses.LayoutBase), but am unable to apply this new layout format to my group in my application... is it treated like a different tag within the layout tag?[code]...
View 1 Replies
May 27, 2011
In Flex, lets say I have a super-class... something like:
class SuperComponent extends DragStack {
private var _childReference:UIComponent;
public function SuperComponent() {
// ???
addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
} private function onCreationComplete(e:FlexEvent):void {
//The 'this[]' technique doesn't seem to work and causes run-time errors:
//trace("Component found: " + this["myButton"]);
}}
And then I make use of the following derived-class in my application (just a mockup MXML as an example):
<!-- Component ChildComponent.mxml -->
<mx:SuperComponent>
<mx:Button id="myButton" label="Press Me!" />
</mx:SuperComponent>
How do I go about verifying the presence of "myButton" from the SuperComponent class, and referencing it? Do I need to use getChildByName( ... ) ?
View 2 Replies
Jun 16, 2011
I've always just developed my projects in as3 instead of mxml and I usually just setup my application to run a main actionscript file as my main doc root, sort of like how you do it in flash but in flash builder I do something like this:[code] how can I call place a call to that function hitme() within the call_from_outside() function between the <fx:Script> tags?The reason why I'm doing this is because I have some flash swfs that I load into another swf file and I can access the top level public functions of those flash swfs, however the top level of the flash builder/flex swfs is the main mxml file not my fake as3 class root. Of course I should think there is a way for me to access the as3 class methods of the mxml component but for keeping things with the same structure, I can bypass having to modify my loader scripts.
View 1 Replies
Nov 25, 2009
how to access the stage from within component code. (I am very new to ActionScript)
Here is the cut down code of the main application entry point:
Code:
package {
import flash.display.Sprite;
public class Main extends Sprite {
[Code]...
I need to access the main stage to add a mouse up event listener.
View 1 Replies