Search Results

Search found 471 results on 19 pages for 'addchild'.

Page 12/19 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Parameter to swf loader with loader class

    - by alejandrobog
    Hi im loading a child swf into my parent swf and I want to pass some parameters to the child swf. Any idea on how to do this. Here is my code: var req:URLRequest = new URLRequest( "test.swf" ); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loadComplete ); loader.load(req); function loadComplete(e:Event){ var childSwf:DisplayObject = e.target.content as DisplayObject; //Im guessing here I need to set the parameter VideoContainer.addChild(childSwf); }

    Read the article

  • Adding button in Actionscript code : Using Flex Builder

    - by dta
    I created a new actionscript project using Flex Builder 3 and tried to run the following file. I get this error : Definitions: fl.controls:Button could not be found. All I want to do is, to add a button to the application. How could I do it? package { import PaperBase; import org.papervision3d.objects.primitives.Cone; import fl.controls.Button; import fl.controls.Label; import fl.events.ComponentEvent; public class cone1 extends PaperBase { public var cone:Cone = new Cone(); protected var sceneWidth:Number; protected var sceneHeight:Number; public function cone1() { sceneWidth = stage.stageWidth sceneHeight = stage.stageHeight; init(sceneWidth*0.5,sceneHeight*0.5);//position of the cone } override protected function init3d():void { cone.scale = 5; cone.pitch(-40) default_scene.addChild(cone); } override protected function processFrame():void { cone.yaw(1);//rotation speed } } }

    Read the article

  • AIR:- Desktop Application related to Window Component (Need some work around)

    - by Mahesh Parate
    Create custom component which contains Combobox and Datagrid. Application conations two button 1) Same Window and 2) New Window. (Label of two button) When you click on “Same Window” button your custom component should get added dynamically in your application. And when you click on “New Window” button your custom component should get open in different window (it should get shifted from application and should appear in Window component). Issue faced:- Clicking on Combobox, list is not getting open as change event doesn’t get fired in Native Window as it looses reference from main application. Issue with DataGrid in Native window (AIR). • DataGridEvent.COLUMN_STRETCH event get affected if try to open datagrid in Native Window. • DataGridEvent get fired but takes long time or even stuck while column stretch Note: Application is an Desktop Application. Only one instance is created in Application for your custom component to preserve current state on your custom component it can be Style, data, or other subcomponent state of your custom component (as above mentioned 2 component are just sample). Please find sample code below:- DataGridStretchIssue.mxml:- < ?xml version="1.0" encoding="utf-8"? < mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" width="800" height="500" < mx:Script < ![CDATA[ import mx.events.FlexEvent; import mx.core.Window; private var dgComp:DataGridComp = new DataGridComp(); private var win:Window; private function clickHandler(event:Event):void{ dgComp.percentWidth = 100; dgComp.percentHeight = 100; dgComp.x = 50; dgComp.y = 100; if(win){ win.close(); } this.addChild(dgComp); } private function openClickHandler(event:MouseEvent):void{ dgComp.x = 50; dgComp.y = 100; win = new Window();; win.width = 800; win.height = 500; win.addChild(dgComp); dgComp.percentWidth = 100; dgComp.percentHeight = 100; dgComp.x = 50; dgComp.y = 100; win.open(true) } ]]> < /mx:Script < mx:HBox <mx:Button id="btnID" click="clickHandler(event)" label="Same Window"/> <mx:Button id="btnIDOpen" click="openClickHandler(event)" label="New Window"/> < /mx:HBox < /mx:WindowedApplication DataGridComp.mxml < ?xml version="1.0" encoding="utf-8"? < mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" <mx:Script> <![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; [Bindable] public var cards:ArrayCollection = new ArrayCollection( [ {label:"Visa", data:1}, {label:"MasterCard", data:2}, {label:"American Express", data:3} ]); private function stretchFn(event:DataGridEvent):void{ trace("--- Stretched---") } ]]> </mx:Script> <mx:HBox> <mx:ComboBox dataProvider="{cards}" width="150"/> <mx:DataGrid columnStretch="stretchFn(event)" > <mx:ArrayCollection> <mx:Object> <mx:Artist>Pavement</mx:Artist> <mx:Price>11.99</mx:Price> <mx:Album>Slanted and Enchanted</mx:Album> </mx:Object> <mx:Object> <mx:Artist>Pavement</mx:Artist> <mx:Album>Brighten the Corners</mx:Album> <mx:Price>11.99</mx:Price> </mx:Object> </mx:ArrayCollection> </mx:DataGrid> </mx:HBox> < /mx:Canvas Can any one suggest me some work around to make my code workable... :)

    Read the article

  • Does AS3 show cacheasbitmap in preview?

    - by Fahim Akhter
    The following code shows me that cacheasbitmap is turning on and off like it is suppose to but, I never get to see it visually like I did in AS2. Is this a error or a change in actionscript? package { import flash.display.Sprite; import flash.events.MouseEvent; public class Bitmapascache extends Sprite { private var isOn:Boolean=false; private var box:mainBox; public function Bitmapascache() { box = new mainBox() box.addEventListener(MouseEvent.MOUSE_DOWN,click); this.addChild(box); } public function click(e:MouseEvent):void { trace("click :"+box.cacheAsBitmap); if(isOn){ box.cacheAsBitmap = false; isOn = false; } else{ box.cacheAsBitmap = true; isOn = true; } } } }

    Read the article

  • Actionscript: Why is drawRoundRectComplex() not documented?

    - by Chunk1978
    in studying actionscript 3's graphics class, i've come across the undocumented drawRoundRectComplex() method. it's a variant of drawRoundRect() but with 8 parameters, the final four being the diameter of each corner (x, y, width, height, top left, top right, bottom left, bottom right). //example var sp:Sprite = new Sprite(); sp.graphics.lineStyle(1, 0x000000); sp.graphics.drawRoundRectComplex(0, 0, 100, 50, 10, 20, 0, 10); addChild(sp); this seems to be a pretty useful method, so i'm just curious if anyone knows of any reasons why adobe chose not to document it?

    Read the article

  • Why does my program crash when given negative values?

    - by Wayfarer
    Alright, I am very confused, so I hope you friends can help me out. I'm working on a project using Cocos2D, the most recent version (.99 RC 1). I make some player objects and some buttons to change the object's life. But the weird thing is, the code crashes when I try to change their life by -5. Or any negative value for that matter, besides -1. NSMutableArray *lifeButtons = [[NSMutableArray alloc] init]; CCTexture2D *buttonTexture = [[CCTextureCache sharedTextureCache] addImage:@"Button.png"]; LifeChangeButtons *button = nil; //top left button = [LifeChangeButtons lifeButton:buttonTexture ]; button.position = CGPointMake(50 , size.height - 30); [button buttonText:-5]; [lifeButtons addObject:button]; //top right button = [LifeChangeButtons lifeButton:buttonTexture ]; button.position = CGPointMake(size.width - 50 , size.height - 30); [button buttonText:1]; [lifeButtons addObject:button]; //bottom left button = [LifeChangeButtons lifeButton:buttonTexture ]; button.position = CGPointMake(50 , 30); [button buttonText:5]; [lifeButtons addObject:button]; //bottom right button = [LifeChangeButtons lifeButton:buttonTexture ]; button.position = CGPointMake(size.width - 50 , 30); [button buttonText:-1]; [lifeButtons addObject:button]; for (LifeChangeButtons *theButton in lifeButtons) { [self addChild:theButton]; } This is the code that makes the buttons. It simply makes 4 buttons, puts them in each corner of the screen (size is the screen) and adds their life change ability, 1,-1,5, or -5. It adds them to the array and then goes through the array at the end and adds all of them to the screen. This works fine. Here is my code for the button class: (header file) // // LifeChangeButtons.h // Coco2dTest2 // // Created by Ethan Mick on 3/14/10. // Copyright 2010 Wayfarer. All rights reserved. // #import "cocos2d.h" @interface LifeChangeButtons : CCSprite <CCTargetedTouchDelegate> { NSNumber *lifeChange; } @property (nonatomic, readonly) CGRect rect; @property (nonatomic, retain) NSNumber *lifeChange; + (id)lifeButton:(CCTexture2D *)texture; - (void)buttonText:(int)number; @end Implementation file: // // LifeChangeButtons.m // Coco2dTest2 // // Created by Ethan Mick on 3/14/10. // Copyright 2010 Wayfarer. All rights reserved. // #import "LifeChangeButtons.h" #import "cocos2d.h" #import "CustomCCNode.h" @implementation LifeChangeButtons @synthesize lifeChange; //Create the button +(id)lifeButton:(CCTexture2D *)texture { return [[[self alloc] initWithTexture:texture] autorelease]; } - (id)initWithTexture:(CCTexture2D *)atexture { if ((self = [super initWithTexture:atexture])) { //NSLog(@"wtf"); } return self; } //Set the text on the button - (void)buttonText:(int)number { lifeChange = [NSNumber numberWithInt:number]; NSString *text = [[NSString alloc] initWithFormat:@"%d", number]; CCLabel *label = [CCLabel labelWithString:text fontName:@"Times New Roman" fontSize:20]; label.position = CGPointMake(35, 20); [self addChild:label]; } - (CGRect)rect { CGSize s = [self.texture contentSize]; return CGRectMake(-s.width / 2, -s.height / 2, s.width, s.height); } - (BOOL)containsTouchLocation:(UITouch *)touch { return CGRectContainsPoint(self.rect, [self convertTouchToNodeSpaceAR:touch]); } - (void)onEnter { [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES]; [super onEnter]; } - (void)onExit { [[CCTouchDispatcher sharedDispatcher] removeDelegate:self]; [super onExit]; } - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint touchPoint = [touch locationInView:[touch view]]; touchPoint = [[CCDirector sharedDirector] convertToGL:touchPoint]; if ( ![self containsTouchLocation:touch] ) return NO; NSLog(@"Button touch event was called returning yes. "); //this is where we change the life to each selected player NSLog(@"Test1"); NSMutableArray *tempArray = [[[UIApplication sharedApplication] delegate] selectedPlayerObjects]; NSLog(@"Test2"); for (CustomCCNode *aPlayer in tempArray) { NSLog(@"we change the life by %d.", [lifeChange intValue]); [aPlayer changeLife:[lifeChange intValue]]; } NSLog(@"Test3"); return YES; } - (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint touchPoint = [touch locationInView:[touch view]]; touchPoint = [[CCDirector sharedDirector] convertToGL:touchPoint]; NSLog(@"You moved in a button!"); } - (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event { NSLog(@"You touched up in a button"); } @end Now, This function: - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event Is where all the shit goes down. It works for all of the buttons except the -5 one. And then, it gets to: NSLog(@"we change the life by %d.", [lifeChange integerValue]); And it crashes at that statement. It only crashes when given anything less than -1. -1 works, but nothing smaller does. Here is the code in the CustomCCNode Class, "changeLife" that is being called. - (void)changeLife:(int)lifeChange { NSLog(@"change life in Custom Class was called"); NSLog(@"wtf is lifechange: %d", lifeChange); life += lifeChange; lifeString = [[NSString alloc] initWithFormat:@"%d",life]; [text setString:lifeString]; } Straight forward, but when the NSnumber is -5, it doesn't even get called, it crashes at the NSlog statement. So... what's up with that?

    Read the article

  • How come this image won't resize to fit the sprite?

    - by George Edison
    I have this snippet of ActionScript code that is supposed to resize an image to fit the sprite: package { import flash.display.Sprite; import flash.display.Bitmap; import flash.events.Event; public class Main extends Sprite { [Embed(source = 'img.png')] private var TheImage:Class; public static const TheImageWidth:Number = 1300; public static const TheImageHeight:Number = 1300; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point var image:Bitmap = new TheImage(); addChild(image); image.scaleX = width / TheImageWidth; image.scaleY = height / TheImageHeight; } } } Why isn't it working?

    Read the article

  • NHibernate Collection Mapping - Read Only Properties

    - by Chris Meek
    I have the following class public class Person { private IList<Person> _children; public IEnumerable<Person> Children { get; } public void AddChild(Person child) { // Some business logic and adding to the internal list } } What changes would I have to make for NHibenrate to be able to persist the Child collection (apart from making everything virtual, I know that one). Do I have to add a setter to the children property which does something like a _children.Clear(); _children.AddRange(value). Currently the model expresses my intent quite nicely but I'm not sure how much alteration is need for NH to be able to help me out with persistence.

    Read the article

  • as3 formatting a textfield

    - by duckofrubber
    Hi, I'm dynamically creating textfields in as3, and formatting them with the TextFormat class. I'm having some issues though with selecting the exact "style" of font to apply to the textfields. My code so far looks like: formatT = new TextFormat( ); formatT.bold = false; formatT.color = 0x000000; formatT.font = "TradeGothic"; formatT.size = 16; var textItem = new TextField(); textItem.text = "foobar"; textItem.setTextFormat(formatT); addChild(textItem); This works ("Trade Gothic" is applied to the enclosed text), however I can't figure out how to apply a specific style of "Trade Gothic", for instance "Light Oblique". Is there some way that I can specify this using the TextFormat class? Thanks.

    Read the article

  • How to increse performance of raster scrolling on Mac ?

    - by Max
    I have a game with a big raster map Now we are using jpeg (4900x4200) And durring the game we need to scroll through this map. We use the following: Class Map extends mx.containers.Canvas and mx.controls.Image on it In constructor we have: public function Map() { super(); image.source = ResourceManager.interactiveManager.map;//big image addChild(image); ...... } for scrolling we are use: if(parentAsCanvas==null){ parentAsCanvas = (parent as Canvas); } parentAsCanvas.verticalScrollPosition = newX; parentAsCanvas.horizontalScrollPosition = newY; In windows, we have very good performance. In Linux and Mac in flashplayer we have a good performance too. But in browsers performance is quite slow! What can we do to resolve it?

    Read the article

  • bufferTime on OSMF

    - by Ronnie
    I am having an issue with OSMF. I have an MP4 that is 40MB. It is being progressively loaded. My issue is the video wont begin playing until the video has fully loaded. I am testing this on a web server. Any idea what's going on or what I am not doing? var mps:MediaPlayerSprite = new MediaPlayerSprite(); mps.x = 159; mps.y = 53; mps.width = 512; mps.height = 288; mps.resource = new URLResource("resources/video/3.4.1.mp4"); addChild(mps); I've even tried adding mps.mediaPlayer.bufferTime = 1; but no luck. I've even tried 0.

    Read the article

  • Why can't I get textWidth from my Text component?

    - by Adam
    var txtIt:Text = new Text(); txtIt.text = full_array[t][0]; txtIt.width = 700; txtIt.buttonMode = true; txtIt.mouseChildren = false; txtIt.selectable = false; txtIt.y = t * 30; trace(txtIt.textWidth); myCanvas.addChild(txtIt); Why can't i get the textWidth for the component? I can get it for textFields.

    Read the article

  • Problems with listening an event in child object in Actionscript

    - by Raigomaru
    I have two classes. The first one (the starting class): package { import flash.display.Sprite; import flash.events.KeyboardEvent; import tetris.*; public class TetrisGame extends Sprite { private var _gameWell:Well; public function TetrisGame() { _gameWell = new Well(); addChild(_gameWell); } } } The second: package tetris { import flash.display.Sprite; import flash.events.KeyboardEvent; public class Well extends Sprite { public function Well() { super(); addEventListener(KeyboardEvent.KEY_DOWN, onKeyboard); } private function onKeyboard(event:KeyboardEvent):void { //some code is here } } } But when I press any buttons on my keyboard, the child class Well doesn't have any reaction. What's the problem?

    Read the article

  • How to open new explorer when clicking links in webpages loaded by app of Flex/Air?

    - by SpawnCxy
    In my application I tried using following codes to do this: <mx:HTML x="0" y="0" width="100%" height="100%" location=“http://www.example.com”/> The page is loaded fine.But when I click the links I found sometimes there was no any response while I need a new explore window opened with the linking url.And also I tried: <mx:Script> <![CDATA[ private function init():void { var req:URLRequest = new URLRequest("http://www.baidu.com"); var a:HTMLLoader = new HTMLLoader(); a.width = 400; a.height = 300; a.load(req); htmlmc.addChild(a); } ]]> </mx:Script> <mx:HTML x="10" y="10" width="345" height="258" id="htmlmc"/> But still got nothing.Any good ideas? Thanks in advance!

    Read the article

  • Flex - How do I use a variable to define the name of an instantiated object

    - by flexfanatic
    Essentially this is what I want to accomplish, however it doesn't work like this. Is there any solution: - The problem is I can't dynamically name a new object... ??? pulling my hair out. import views.printingView; public function initComponent(o:Array):void{ SomeObject::Array = o; for(i=0; i <=SomeObject.length-1; i++){ 'invoice'+{SomeObject[i].namedID}:printingView = new printingView(); someDisplayContainer.addChild('invoice'+{SomeObject[i].namedID}); 'invoice'+{SomeObject.namedID}.publicInitFunction(SomeObject[i]); } }

    Read the article

  • Rotate a drawed rectangle in flex

    - by Arif
    i wrote the following code for draw a rotate rectangle var s:UIComponent = new UIComponent(); s.graphics.lineStyle(1, 0x0000FF); s.graphics.drawRect(50, 50, 200, 200); s.rotation = 30; template.addChild(s); where template is a canvas. Its rotate nicely but the problem is the position is not in right place. i.e. it is not in (50,50) after rotate. How can i solve this problem? Thanks in advance.

    Read the article

  • attaching id to a movieclip

    - by Ross
    I have a loop that creates mc from a database for (var i:Number = 0; i < t.length; i++) { var portfolioItem:PortfolioItem = new PortfolioItem(); addChild(portfolioItem); portfolioItem.name = t[i][0]; portfolioItem.addEventListener(MouseEvent.CLICK, getThisName); } public function getThisName(evt:Event) { trace(evt.target.name); } I try and assign t[i][0] which is the table id to the name attribute but I jsut get 'instance4' or instance 14. How can I give these dynamically create mc's a name or custom property? ideally I would like to use a custom property called portfolio.id but would use the name property or another default property if it works.

    Read the article

  • Get the ID of a Child in a cascade="all" relationship, while adding it to a collection, in Hibernate

    - by Marco
    Hi, i have two Entities, "Parent" and "Child", that are linked through a bidirectional one-to-many relationship with the cascade attribute set to "all". When adding a Child object to the Parent children collection using the code below, i can't get the ID of the persisted child until i commit the transaction: Parent p = (Parent) session.load(Parent.class, pid); Child c = new Child(); p.addChild(c); // "c" hasn't an ID (is always zero) However, when i persist a child entity by explicitly calling the session.save() method, the ID is created and set immediately, even if the transaction hasn't been committed: Child c = new Child(); session.save(c); // "c" has an ID Is there a way to get the ID of the child entity immediately without calling the session.save() method? Thanks

    Read the article

  • 1136: Incorrect number of arguments. Expected 0.? AS3 Flash Cs4 (Round 2)

    - by charmaine
    (I have asked this before but I dont think I was direct enough with my question and therefore it did not get resolved so here goes again!) I am working through a book called Foundation Actionscript 3.0 Animation, making things move. I am now on Chapter 9 - Collision Detection. On two lines of my code I get the 1135 error, letting me know that I have an incorrect number of arguments. I have highlighted the two areas in which this occurs with asterisks: package { import flash.display.Sprite; import flash.events.Event; public class Bubbles extends Sprite { private var balls:Array; private var numBalls:Number = 10; private var centerBall:Ball; private var bounce:Number = -1; private var spring:Number = 0.2; public function Bubbles() { init(); } private function init():void { balls = new Array(); ***centerBall = new Ball(100, 0xcccccc);*** addChild(centerBall); centerBall.x = stage.stageWidth / 2; centerBall.y = stage.stageHeight / 2; for(var i:uint = 0; i < numBalls; i++) { ***var ball:Ball = new Ball(Math.random() * 40 + 5, Math.random() * 0xffffff);*** ball.x = Math.random() * stage.stageWidth; ball.y = Math.random() * stage.stageHeight; ball.vx = Math.random() * 6 - 3; ball.vy = Math.random() * 6 - 3; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = balls[i]; move(ball); var dx:Number = ball.x - centerBall.x; var dy:Number = ball.y - centerBall.y; var dist:Number = Math.sqrt(dx * dx + dy * dy); var minDist:Number = ball.radius + centerBall.radius; if(dist < minDist) { var angle:Number = Math.atan2(dy, dx); var tx:Number = centerBall.x + Math.cos(angle) * minDist; var ty:Number = centerBall.y + Math.sin(angle) * minDist; ball.vx += (tx - ball.x) * spring; ball.vy += (ty - ball.y) * spring; } } } private function move(ball:Ball):void { ball.x += ball.vx; ball.y += ball.vy; if(ball.x + ball.radius > stage.stageWidth) { ball.x = stage.stageWidth - ball.radius; ball.vx *= bounce; } else if(ball.x - ball.radius < 0) { ball.x = ball.radius; ball.vx *= bounce; } if(ball.y + ball.radius > stage.stageHeight) { ball.y = stage.stageHeight - ball.radius; ball.vy *= bounce; } else if(ball.y - ball.radius < 0) { ball.y = ball.radius; ball.vy *= bounce; } } } } I think this is due to the non-existance of a Ball.as, when reading the tutorial I assumed it meant that I had to create a movie clip of a ball on stage and then export it for actionscript with the class name being Ball, however when flicking back through the book I saw that a Ball.as already existed, stating that I may need to use this again later on in the book, this read: package { import flash.display.Sprite; public class Ball extends Sprite { private var radius:Number; private var color:uint; public var vx:Number=0; public var vy:Number=0; public function Ball(radius:Number=40, color:uint=0xff0000) { this.radius=radius; this.color=color; init(); } public function init():void { graphics.beginFill(color); graphics.drawCircle(0, 0, radius); graphics.endFill(); } } } This managed to stop all the errors appearing however, it did not transmit any of the effects from Bubbles.as it just braught a Red Ball on the center of the stage. How would I alter this code in order to work in favour of Bubbles.as? Please Help! Thanks!

    Read the article

  • Looping through an array to remove a touched object (iPhone/Cocos2d)

    - by Michael Lowe
    I am using cocos2d to build a game. I have an array of CCSprites and I want to be able to touch them and delete the one that was touched. Right now I have this... -(void) spawn { mySprite = [CCSprite spriteWithFile:@"image.png"]; mySprite.position = ccp(positionX,positionY); [myArray addObject:mySprite]; [self addChild:mySprite]; } - (void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView: [touch view]]; NSUInteger i, count = [myArray count]; for (i = 0; i < count; i++) { mySprite = (CCSprite *)[myArray objectAtIndex:i]; if (CGRectContainsPoint([mySprite boundingBox], location)) { [self removeChild:mySprite cleanup:YES]; } } I have never done this before. Does anyone have a solution? Thanks, Michael

    Read the article

  • Problems with listening for an event in child object in Actionscript

    - by Raigomaru
    I have two classes. The first one (the starting class): package { import flash.display.Sprite; import flash.events.KeyboardEvent; import tetris.*; public class TetrisGame extends Sprite { private var _gameWell:Well; public function TetrisGame() { _gameWell = new Well(); addChild(_gameWell); } } } The second: package tetris { import flash.display.Sprite; import flash.events.KeyboardEvent; public class Well extends Sprite { public function Well() { super(); addEventListener(KeyboardEvent.KEY_DOWN, onKeyboard); } private function onKeyboard(event:KeyboardEvent):void { //some code is here } } } But when I press any buttons on my keyboard, the child class Well doesn't have any reaction. What's the problem?

    Read the article

  • ActionScript BitmapData Built-in To Bitmaps?

    - by TheDarkIn1978
    i've used a Loader and URLRequest to download a .png from the internet and add it to my display list. since it's already a bitmap, does it have built in bitmap data already? or do i have to create the bitmap data myself? also, why does the same trace statement return false in the mouseMoveHandler when it outputs true in the displayImage function? var imageLoader:Loader = new Loader(); imageLoader.load(new URLRequest("http://somewebsite.com/image.png")); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, displayImage); function displayImage(evt:Event):void { addChild(evt.target.content); addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); trace(evt.target.content is Bitmap); //outputs 'true' } function mouseMoveHandler(evt:MouseEvent):void { trace(evt.target.content is Bitmap); //outputs 'false' }

    Read the article

  • dojo.connect won't connect 'onclick' with button

    - by Daniel
    I'm running into a problem using dojo.connect() to connect an 'onclick' event with this button: <button dojoType="dijit.form.Button" widgetId="inbox_button" id="inbox_button">Inbox</button> and the code making the connection is: var inbox_button=dojo.byId("inbox_button"); dojo.connect(inbox_button,'onclick',function(){ var container=dijit.byId("center"); container.addChild(new dijit.layout.ContentPane({region: "left", content: "...", style: "width: 100px;"})) }); However, instead of executing the function when the button is clicked, ANY onclick event triggers the function, and I end up with a lot of children containers. Even though I'm pretty certain the .connect() function should be available as part of dojo's base functionality, I've 'required' it explicitly: dojo.require("dojo._base.connect"); Any ideas as to why this might be happening?

    Read the article

  • creating button

    - by eomer
    hi I started to learn as3 using fdt i managed to put texts on screen now i want to show the text after the button is clicked but the button does not appear here is the code ` package { import flash.events.MouseEvent; import flash.media.Camera; import mx.controls.Button; import flash.display.Sprite; import flash.text.TextField; public class test2 extends Sprite { private var tField:TextField; public function click(e:MouseEvent):void { tField = new TextField(); tField.text="ffff"; addChild(tField); } public function test2():void { var aa:Button=new Button(); aa.label="deneme"; aa.x=100; aa.y=200; aa.addEventListener(MouseEvent.CLICK, click) } } } ` help me pleaseee

    Read the article

  • Need to identify the component's selectedItem

    - by theband
    I am creating a lot of dynamic flex components like RadioButton, Combo Box, CheckBox. if(type=="mx.controls.CheckBox"){ //if(rep.currentIndex<5){ for each(j in x){ k=createNewInstanceOfClass(rep.currentItem.type); k.id="radioGroup"+rep.currentItem; k.label=j.linkname; k.data=j.linkname; linkPanel[rep.currentIndex].addChild(DisplayObject(k)); } When i click on Submit finally i need to get all the selected Values in each question. All the components are dynamically created at runtime.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >