Remove watermark context menu


Hi;

I use an SWC component that adds watermark image and context menu on right click. The component is very expensive ( 3, 000 euro!). Is there some way to remove the right click context menu
Posted On: Thursday 3rd of January 2013 10:22:04 PM Total Views:  253
View Complete with Replies

RELATED TOPICS OF Flash / ActionScript PROGRAMMING LANGUAGE




addChild/removeChild Problem

I have no ideo why that smily face is in there or why there are some random spaces, like in that "s ayhelp" and "st ophelp" business. Those aren't in my code. Everything else in the code looks correct.
VIEWS ON THIS POST

72

Posted on:

Thursday 25th October 2012
View Replies!

Can't remove all loaded children in a gallery because can't close() a loader!

0 down vote favorite This is the code i used in a gallery that loads images sequentally. My problems comes in when you have to open a different image album and have to eliminate all the previously loaded children in the movieclip. The problem is that sometimes the user leaves the album page before ALL the pics laod so when they click on a new album to open it a new image is placed somewhere else cause the loader has already been launched. I've tryd to close() the loader but it doesn't seem to work. I'd appreciate it inmensly if you can give me a hand.
VIEWS ON THIS POST

241

Posted on:

Thursday 25th October 2012
View Replies!

AS3.0>>> removeChild

I'm assuming some of you's must be doin some AS3.0 so i'll post it here to see if anyone knows the answer. i have an array of MovieClips that i'm checking in an enterFrame event to see if the scaleX has hit one... if it has remove the child from the display list. I keep getting an ArgumentError: Error #2025: The DisplayObject supplied must be a child of the caller. now... what i'm doing is adding a child on every frame (a mc)... pushing it into an array and then checking the whole array to see if nay have hit their target scaleX's as below Code: for (var i:int = this.ball_array.length - 1; i >= 0; i--) { if (this.ball_array[i].scaleX >= 1) { this.removeChild(this.ball_array[i]); } } there's obviously somit worng with the way i'm doing this. Does anyone have any ideas Cheers Jimmy
VIEWS ON THIS POST

84

Posted on:

Thursday 25th October 2012
View Replies!

How would you remove these listeners?

PHP Code: \t\t\t\tfunctionaddListeners(...objects):void \t\t\t\t{ \t\t\t\t\t\tfor(vari:int=0;i
VIEWS ON THIS POST

77

Posted on:

Thursday 25th October 2012
View Replies!

removeChild from inside a class

, I have a hopefully very simple problem. I created two children from my document class "MainClass". One (hero) is of the class "HeroDo" and another is from the class "canDy". Code: public static var hero:HeroDo=new HeroDo public static var blue:canDy=new canDy public function MainClass () { this.addChild(blue) this.addChild(hero) ... Now the simple thing I want to do is to remove the "blue" child from within a function of the "hero" child and the hero child to remove itself from "its inside". I tried this, but it gives me an error. :C Code: removeChild(MainClass.blue) I'm very new to AS3, so sorry if that is a stupidly easy question.
VIEWS ON THIS POST

72

Posted on:

Thursday 25th October 2012
View Replies!

Flash question about removeChild()

Hi. So, I read this article "What removeMovieClip() Becomes in AS3" here on kirupa, and I still don't get something about it. So I put an MC on the stage using addChild(), which I linked to a class in the properties. That class checks (among other things) the Y-position of the MC in each frame, and then removes it from the display list when it reaches a certain position. Now, the code keeps running of course, and thus try to remove the MC each frame, since it still seems to be at the wrong position. Since it has already been removed, I get error messages of course. I could put most of the code of that class in a try/catch thing or check with some if's whether the MC is still on the stage. However, depending on the amount of MCs I put on the stage this way, I'd end up with quite some amount of useless code that would check stuff each turn. Now in that article was said: However, removeChild() will not remove the instance from memory, only the display list so it is not seen by the user. If you need the movie clip to be removed from memory, you will need to make sure there are no variables left that reference that movie clip. For class properties, null is used; for dynamic properties, delete. My question is: Do I then have to manually delete every variable, listener, property etc that might be associated to that clip So first the event-listener that checks each frame where the MC is, then the variables containing other information about the MC and so on... or is there some kind of function that does all this for me
VIEWS ON THIS POST

73

Posted on:

Thursday 25th October 2012
View Replies!

Unload and removeChild problem

I'm having trouble trying to get rid of an image in my container when I click on a thumbnail. I keep getting an error saying DisplayObject must be a child of the caller. I've looked around the web and can't figure out what I'm doing wrong, nor am I sure what the error means when its referencing the caller. Any help appreciated! Code: stop(); import fl.containers.UILoader; import caurina.transitions.*; //---------loading the external xml file------- var urlRequest:URLRequest = new URLRequest("luxury.xml"); var urlLoader:URLLoader = new URLLoader(); var myXML:XML = new XML(); var xmlList:XMLList; myXML.ignoreWhitespace = true; urlLoader.addEventListener(Event.COMPLETE,fileLoaded); urlLoader.load(urlRequest); var featureURL:String = new String; var main_content:Sprite; var featureLoader:Loader; var featureDesc:String; //--------holds the paths to the thumbnails------- var arrayURL:Array = new Array(); //--------holds the paths to the big photos------- var arrayName:Array = new Array(); //--------holds the thumbnail objects------- var holderArray:Array = new Array(); //--------represents the number of collumns------- var nrColumns:uint = 2; //-------represents the container of our gallery var sprite:Sprite = new Sprite(); addChild(sprite); var thumb:Thumbnail; //-------- the thumbnails container------- var thumbsHolder:Sprite = new Sprite(); sprite.addChild(thumbsHolder); //-------- the photoLoader container------- sprite.addChild(imageArea); //-------- loads the big photo------- var photoLoader:UILoader = new UILoader(); photoLoader.y = 30; photoLoader.x = 10; photoLoader.width = 550; photoLoader.height = 330; imageArea.addChild(photoLoader); //-------load feature--------------- function loadFeature():void{ featureLoader = new Loader(); featureLoader.load(new URLRequest(featureURL)); featureLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadImage); } function loadImage(event:Event):void{ imageArea.addChild(featureLoader.content); featureLoader.content.x = 25; featureLoader.content.y = 30; imageArea.desc.text = featureDesc; } /* we loop through the xml file populate the arrayURL, arrayName and position the thumbnalis */ function fileLoaded(event:Event):void { myXML = XML(event.target.data); xmlList = myXML.children(); ParseProperty(myXML); loadFeature(); for (var i:int=0; i
VIEWS ON THIS POST

100

Posted on:

Thursday 25th October 2012
View Replies!

Does BitmapData.dispose() remove memory occupied by its Bitmap

, This is my scenario 1: I upload an image 2: Without altering it,I make a copy of it and use it display to users in resized format note: I won't display the original image. 3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap. For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb. And when I delete all the images the size decreases to 81 MB only. So,I feel the loaded bitmap is not completely removed. Any idea what should I do
VIEWS ON THIS POST

80

Posted on:

Thursday 25th October 2012
View Replies!

all remove or no remove

This is the code for my rotating menu in scene two,the problem description is in below //Save the center coordinates of the stage var centerX:Number = stage.stageWidth / 2; var centerY:Number = stage.stageHeight / 2; var NUMBER_OF_ITEMS:uint = 11; //Radius of the menu circle (horizontal and vertical) var radiusX:Number = 200; var radiusY:Number = 100; //Angle difference between the items (in radians) var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180; //How fast a single circle moves var angleSpeed:Number = 0; //Scaling speed of a single circle var scaleSpeed:Number = 0.0002; //This vector holds all the items var itemVector:Vector. = new Vector. ; //This loop creates the items and positions them //on the stage for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) { //Create a new menu item var item:Item = new Item(); //Get the angle for the item (we space the items evenly) var startingAngle:Number = angleDifference*i; //Set the x and y coordinates item.x = centerX + radiusX * Math.cos(startingAngle); item.y = centerY + radiusY * Math.sin(startingAngle); //Save the starting angle of the item. //(We have declared the Item class to be dymamic. Therefore, //we can create new properties dynamically.) item.angle = startingAngle; //ow no mouse children item.mouseChildren = false; //Add the item to the vector itemVector.push(item); //Add the item to the stage addChild(item); //Add an item number to the item's text field if(i==1){ item.itemText.text = "1970"; item.addEventListener(MouseEvent.CLICK,y1970); function y1970(event:MouseEvent):void { gotoAndPlay(1,"y1970"); parent.removeChild(this); } } else if(i==2){ item.itemText.text="1975"; item.addEventListener(MouseEvent.CLICK,y1975); function y1975(event:MouseEvent):void { gotoAndStop(1,"y1975"); parent.removeChild(this); } } else if(i==3){ item.itemText.text="1980"; item.addEventListener(MouseEvent.CLICK,y1980); function y1980(event:MouseEvent):void { gotoAndStop(1,"y1980"); parent.removeChild(this); } } else if(i==4){ item.itemText.text="1985"; item.addEventListener(MouseEvent.CLICK,y1985); function y1985(event:MouseEvent):void { gotoAndStop(1,"y1985"); parent.removeChild(this); } } else if(i==5){ item.itemText.text="1990"; } else if(i==6){ item.itemText.text="1995"; } else if(i==7){ item.itemText.text="2000"; } else if(i==8){ item.itemText.text="2005"; } else if(i==9){ item.itemText.text="2010"; } else if(i==10){ item.itemText.text="2015"; } else{ item.itemText.text="2020"; } } //We use ENTER_FRAME to animate the items addEventListener(Event.ENTER_FRAME, enterFrameHandler); //This function is called in each frame function enterFrameHandler(e:Event):void { //Calculate the angle speed according to mouse position angleSpeed = (mouseX - centerX) / 5000; //Loop through the vector for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) { //Save the item to a local variable var item:Item = itemVector[i]; //Update the angle item.angle += angleSpeed; //Set the new coordinates item.x = centerX + radiusX * Math.cos(item.angle); item.y = centerY + radiusY * Math.sin(item.angle); //Calculate the vertical distance from centerY to the item var dy:Number = centerY - item.y; //Scale the item according to vertical distance item.scaleY = (dy / radiusY); //If we are above centerY, double the y scale if (item.y
VIEWS ON THIS POST

56

Posted on:

Thursday 25th October 2012
View Replies!

removeChild?

hello. How do I remove a child for good I am loading some text via xml and when I go to remove the child and load the next text, the next set of text goes on top of the old set of text because it is still in the sprite that was used and is being reused for the new text. I used removeChild(masterHolder); and then called the function which loads the next xml text. If that does not make sense pls let me know!
VIEWS ON THIS POST

70

Posted on:

Thursday 25th October 2012
View Replies!

removeChild not working

, I am new to flash as3, I am trying to figure out how do I remove a child after I add one into a mc. here is my code: var two_mc:Two=new Two(); pic_mc.addChild(two_mc); pic_mc.removeChild(pic_mc.two_mc); The error that is shows up is: TypeError: Error #2007: Parameter child must be non-null. at flash.display:isplayObjectContainer/removeChild() at test2mc_fla::MainTimeline/frame1() I cant remove the child if i add a child inside a movieclip, is there something that iam doing wrong Thank you
VIEWS ON THIS POST

88

Posted on:

Thursday 25th October 2012
View Replies!

detect cursor over context menu

i have a class which hides mouse cursor if not moved for certain amount of time. also i can pass and array of objects to the class for which i dont want to hide a cursor if mouse if over that specific objects. it uses a hit test point to find if its over any of objects. i tried to pass a context menu, but i am getting an error: Property hitTestPoint not found on flash.ui.ContextMenu and there is no default value. is there a way to pull this of
VIEWS ON THIS POST

60

Posted on:

Thursday 25th October 2012
View Replies!

removeChild(myMc) Problem?

Hi , I am pretty new to as3. I am trying to build a website, and here is the logic behind my problem. 1- I have a "Gallery" button which will go and get the "Gallery" movie clip from the library when clicked 2- I have an "About" button which will go and get the "About" movie clip from the library when clicked HERE IS THE PROBLEM: the movie clips adds up on top of each other, How am I supposed to remove anyother pre-existing movie clips on the stage and the removeChild(); doesn't work here is the colde about_btn.addEventListener(MouseEvent.CLICK, getAbout); function getAbout(event:MouseEvent):void { var myMovieClip:MovieClip = new aboutTest(); addChild(myMovieClip); setStage(); stage.addEventListener(Event.RESIZE, stageResize); function setStage():void { var WIDTH:Number = stage.stageWidth; var HEIGHT:Number = stage.stageHeight; myMovieClip.x = WIDTH/2; myMovieClip.y =330; } function stageResize(e:Event):void { setStage(); } } galleryTest_btn.addEventListener(MouseEvent.CLICK, getGallery); function getGallery(event:MouseEvent):void { var myMovieClip2:MovieClip = new galleryMovieTest(); addChild(myMovieClip2); setStage(); stage.addEventListener(Event.RESIZE, stageResize); function setStage():void { var WIDTH:Number = stage.stageWidth; var HEIGHT:Number = stage.stageHeight; myMovieClip2.x = WIDTH/2; myMovieClip2.y =330; } function stageResize(e:Event):void { setStage(); } var myMovieClip:MovieClip = new aboutTest(); removeChild(myMovieClip); } is this the right way to make a website at all Thankx a loooot
VIEWS ON THIS POST

63

Posted on:

Thursday 25th October 2012
View Replies!

Flex How to remove/disable link from loaded swf content?

How to remove/disable link from loaded swf content In flex I have an image component, which loads swf through "source". This loaded swf contains "clickable" links. I want to this loaded swf a simple image behave.
VIEWS ON THIS POST

113

Posted on:

Thursday 25th October 2012
View Replies!

remove MovieClip

how can I remove a movie clip on MOUSE OUT What am I doing wrong here that is giving me this error Error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display:isplayObjectContainer/removeChild() at MethodInfo-14() out Code Used: Code: item.addEventListener(MouseEvent.MOUSE_OVER, roll4); function roll4(e:MouseEvent):void { trace("rolled"); var realShirt1:real = new real(); addChild(real1); } item.addEventListener(MouseEvent.MOUSE_OUT, out4); function out4(e:MouseEvent):void { removeChild(real1); }
VIEWS ON THIS POST

72

Posted on:

Thursday 25th October 2012
View Replies!

How Do I add contextMenu to stage?

So in AS2 you could add a contextMenu for the whole movie like this: Code: var newMenu = new ContextMenu(); newMenu.hideBuiltInItems(); _root.menu = newMenu; There is no _root in AS3. So in my Document class I tried this: Code: stage.contextMenu = new ContextMenu(); Which results in this error: Error: Error #2071: The Stage class does not implement this property or method. at Error$/throwError() at flash.display::Stage/set contextMenu() I have also tried just adding items to stage.contextMenu but that didn't work either. I also added a custom context menu to my Document class but that doesn't work for the whole movie. So does anyone know if there is something I can do to set the contextMenu for the whole movie
VIEWS ON THIS POST

86

Posted on:

Thursday 25th October 2012
View Replies!

Sprite trying to remove itself from the stage is throwing errors.

I'm trying to have a bullet Sprite remove itself from the stage once it is off the stage, but Flash keeps throwing #1009 errors at me. I've looked over the code several times and don't understand what's wrong. Bullet code: Code: package { import flash.display.Sprite; import flash.display.MovieClip; import flash.events.*; public class Bullet extends Sprite { private var bullet_direction; private var bullet_speed; public function Bullet(xLoc:Number, yLoc:Number, angle:Number, speed:Number) { x = xLoc; y = yLoc; bullet_direction = angle; bullet_speed = speed; addEventListener(Event.ENTER_FRAME, BulletMovement,false,0,true); } public function BulletMovement(e:Event) { y -= bullet_speed * Math.sin(bullet_direction); x += bullet_speed * Math.cos(bullet_direction); if ( x > 500 || x < -20 || y > 660 || y < -20 ) { DestroyBullet(); } } public function DestroyBullet():void { removeEventListener(Event.ENTER_FRAME, BulletMovement); (stage as MovieClip).removeChild(this); } } } Error message: Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Bullet/DestroyBullet() at Bullet/BulletMovement()
VIEWS ON THIS POST

110

Posted on:

Thursday 25th October 2012
View Replies!

remove child = null before setting it to null?

sometimes I remove child and trace it afterwards and it outputs null although I havent yet set it to null, why is that and do I need to set it to null also in that case Code: trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //[object MovieClip] holderArr[loadedThumbs].removeChild(holderArr[loadedThumbs].getChildByName("photo_bg")); trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //null holderArr[loadedThumbs].photo_bg = null; //trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //null
VIEWS ON THIS POST

220

Posted on:

Thursday 25th October 2012
View Replies!

Making a generated movieclip self destruct (remove from screen) after x seconds?

I'm making a game where little parcels appear and if they aren't dragged to the correct zone within 5 seconds, they disappear and the player loses points. The problem i'm having is that i'm generating the movieclip parcel objects as follows: function generateMCByString(id:String):MovieClip { var mcObj:Object = null; mcObj = getDefinitionByName(id.toString()); return (new mcObj()) as MovieClip; } Then creating the movieclip and adding it to the screen depending on certain conditions as follows: mc = generateMCByString(currentParcel); mc.value = currentParcel; addChild(mc); mc.x = 386.9; mc.y = -100; mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStarter); mc.addEventListener(MouseEvent.MOUSE_UP, dragStopper); tweenMove0 = new Tween(mc, "y", None.easeOut, -100, 238, 3, true); currentParcel is 1 of 3 (randomly selected) movieclip names (redParcel, yellowParcel and orangeParcel). What I need to do is add some code to say "after a movieclip has been generated...if it is still here in 5 seconds time..." It sounds simple but I can't figure it out for the life of me! I've tried setInterval with something like: timedProcess = setInterval(timeCheck, 5000); but how can I pass the actual movieclip "handle" along with the function so that timeCheck knows which movieclip to delete Any suggestions gratefully received!
VIEWS ON THIS POST

76

Posted on:

Thursday 25th October 2012
View Replies!

removeChild()

Hi - In my simple code I am adding a swf via addChild. Fine. Code: var nws:Loader = new Loader() nws.load(new URLRequest("news.swf")) addChild(nws) however further on in my code - I want this swf or nws var to be removed when clicking on another button .. so I use removeChild(nws); within another function. But AS3 comes up with an error saying that nws is undefined property with this removeChild line. How else can I say "when nws is loaded - and upon clicking this button - remove it" \t
VIEWS ON THIS POST

58

Posted on:

Thursday 25th October 2012
View Replies!

How to remove childs from external Swfs?

I have a huge doubt about controlling childs with external movies.. For example: Code: var myLoader:Loader = new Loader(); addChild(myLoader); The external swfs are loaded inside the myLoader variable.. How manage the external movies if they have a eventListener in a button like Code: removeMC.addEventListener(MouseEvent.CLICK, removeSwf); function (e:MouseEvent):void{ trace("What can I do"); } Simple doubt.. But I Need help!
VIEWS ON THIS POST

229

Posted on:

Thursday 25th October 2012
View Replies!

Problems with removechild

I wonder if someone can help me with removeChild i made a class preloadContent, it preloads content but when i want to load the next external image or swf he doesn't remove the old content, can someone help me with that, its a reocuring problem for me i dont understand the removechild stuff. this is my class: Code: package { import gs.*; import gs.easing.*; import flash.display.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.*; import flash.net.*; public class PreloadContent extends MovieClip { public var main; public var xmlmenu; public var imageLoader:Loader; public var container; public var placeholder; public var changeSize; public var url; public var firstTime:Boolean = true; public var hoog; public var breed; public function PreloadContent(mainClass, container, placeholder, changeSize):void { this.main = mainClass; this.container = container; this.placeholder = placeholder; this.changeSize = changeSize; } public function preloadContent(contentUrl, hoog, breed):void { this.url = contentUrl; // Show Preloader this.placeholder.preloader.visible = true; this.hoog = hoog; this.breed = breed; // Set properties on my Loader object imageLoader = new Loader(); imageLoader.load(new URLRequest(url)); imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); } public function imageLoaded(e:Event):void { // Hide Preloader this.placeholder.preloader.visible = false; this.changeSize.changeSize(this.hoog, this.breed); // The container animation takes 1 seconde so wait until the animation is done and then load the image TweenLite.to(this.container, 1, {onComplete:placeContent}); } public function placeContent():void { // remove content if (firstTime == false) { this.placeholder.imageLoadArea.removeChild(imageLoader); } // Load Content this.placeholder.imageLoadArea.addChild(imageLoader); trace(image); firstTime = false; } public function imageLoading(e:ProgressEvent):void { // Get current download progress var loaded:Number = e.bytesLoaded / e.bytesTotal; // Send progress info to "preloader" movie clip this.placeholder.preloader.SetProgress(loaded); } } }
VIEWS ON THIS POST

239

Posted on:

Thursday 25th October 2012
View Replies!

How to remove child?

When beginning without any key pressed the ryustance_mc plays as it should. When right or left key is pressed the ryuwalk_mc plays but the ryustance_mc plays at the background. How to remove it from the holder The thing is when I stop pressing any of the keys then ryustance_mc must play again. function control(event:Event):void { if(rightKeyIsDown) { holder_mc.addChild(ryuwalk_mc); ryuwalk_mc.play(); holder_mc.x += speed; } if(leftKeyIsDown) { holder_mc.addChild(ryuwalk_mc); ryuwalk_mc.play(); holder_mc.x -= speed; } } initializeGame();[/code] Please help me. Thank You
VIEWS ON THIS POST

231

Posted on:

Thursday 25th October 2012
View Replies!

removeChild from different frame?!?!

hello again friends... happy easter! I am having a rough time dealing with this problem: I have a set of buttons on the main timeline that gotoandplays movieclips that reside in different frames. These movieclips are on the stage by using addChild statements. As I click a button and it takes me to that specific frame, I am having hard time removing these movieclips using conditionals when I click on one of the buttons... I know it is hard to explain, but it probably is a simple problem a noob like me can't solve... I tried to replicate my problem in the attached source file... so it may be easier for someone to understand my specific question. *Again, I have to use addChild statements for these movieclips on each frame... I know this would be no issue if it were just timeline object based... Please help! It would be greatly appreciated... and happy easter!
VIEWS ON THIS POST

53

Posted on:

Thursday 25th October 2012
View Replies!

remove duplicates from array ?

How can I remove duplicates from my array {0, 0, 1, 1, 2, 3, 4, 4} ---> {0,1,2,3,4}
VIEWS ON THIS POST

44

Posted on:

Thursday 25th October 2012
View Replies!

button inside a movieclip needs to remove it

hi there. long time reader, first time poster. i have a project i'm working on which is essentially a lot of buttons on a stage, which launch movieclips when clicked. i've figured out how to make it work for one of the buttons, but i know there's a way i can make it work for all the buttons using classes. i'll get to that later. at the moment what i'm struggling with is trying to code for a "close" button that is within that movieclip. i'm using addchild to make the clip appear, but i'm not sure where to code the removechild code. lil' help i'll attach my code. (ps, if anyone wants to help me solve the class issue, that'd be nice as well) //main loads// function Main () { //put eventlisteners here// mission_btn.addEventListener(MouseEvent.CLICK, misspop); } Main (); var newPopupopup = new Popup() //functions// function misspop (e:MouseEvent): void { newPopup.x = 150; newPopup.y = 100; this.addChild(newPopup); this.close_btn.addEventListener (MouseEvent.CLICK, misshide); } function misshide (e:MouseEvent) : void { removeChild(newPopup); }
VIEWS ON THIS POST

74

Posted on:

Thursday 25th October 2012
View Replies!

removeChildAt and timer

im trying to have it so when the timer is up the child is removed so i use this code Code: var hTimer:Timer = new Timer(1000,1) hTimer.addEventListener(TimerEvent.TIMER, time) hTimer.start() function time(Event:TimerEvent):void{ trace("time") this.removeChildAt(0) } it traces fine but comes up with the error TypeError: Error #1006: removeChildAt is not a function. at MethodInfo-21() at flash.utils::Timer/flash.utils:Timer::_timerDispatch() at flash.utils::Timer/flash.utils:Timer::tick() what is wrong
VIEWS ON THIS POST

48

Posted on:

Thursday 25th October 2012
View Replies!

Loader Doesn't Implement removeChild?

, I made a class that subclasses Loader and when I try to call the removeChild method it says that Loader doesn't implement that particular function. However when I look in the docs it says that removeChild is an inherited method. I thought maybe I was providing the wrong parameter but I'm just passing a movieclip to the removeChild method so I really don't know what could be wrong. Here's the code (note that Preloader subclasses movieclip): Code: package { import flash.display.Loader; import Preloader; import flash.display.LoaderInfo; import flash.events.Event; import flash.events.ProgressEvent; public class ImageLoader extends Loader { private var preloader:Preloader; //preloader shown for image being loaded public function ImageLoader(w:int,h:int) { preloader=new Preloader(w,h); this.contentLoaderInfo.addEventListener(Event.INIT,addLoaderListeners); } private function addLoaderListeners(e:Event):void { e.target.addEventListener(Event.OPEN,showPreloader); e.target.addEventListener(ProgressEvent.PROGRESS,showProgress); e.target.addEventListener(Event.COMPLETE,showLoadResult); } private function showPreloader(e:Event):void { addChild(preloader); } private function showProgress(e:Event):void { preloader.update(e.target.bytesLoaded,e.target.bytesTotal); } private function showLoadResult(e:Event):void { removeChild(preloader); } } }
VIEWS ON THIS POST

45

Posted on:

Thursday 25th October 2012
View Replies!

AS3 add/remove Event Listeners within functions...

I might just be massively retarded but I'm having trouble adding or removing event listeners within functions... I know this has worked for me before but I seem to be doing something wrong now. Sigh... If anyone can explain to me why I'm recieving ReferenceError: Error #1069: Property ROLL_OUT not found on flash.events.MouseEvent and there is no default value. I'd appreciate it a ton! It's just a simple removeEventListener within a rollover/rollout function... Aargh!
VIEWS ON THIS POST

52

Posted on:

Thursday 25th October 2012
View Replies!

removeEventListener function will nicht

Good morning! I am at daggers drawn with the following. PHP Code: functiononMouseclick(e:MouseEvent):void{ \t\tif(e.target==buttonHome){ \t\t\t\tvarnoEventListener:Array=\tnewArray("buttonFolioDraft","buttonFolioPhot","buttonFolio2", \t\t\t\tdisattachEventListener(buttonArray,noEventListener); \t\t} } and: PHP Code: functiondisattachEventListener(array:Array,filter:Array):void{ /**RemoveEventListenerfromallelementsofanArraythatnamesarematchingone ofthefilterStrings**/ \t\tvardisattach:Array=newArray(); \t\tfor(vari:uint=0;i
VIEWS ON THIS POST

50

Posted on:

Thursday 25th October 2012
View Replies!

How to use removeChild

I'm loading in pictures in my timeline (1 picture per frame). I want to put in the removeChild command in the function, but the problem is, it creates an error on the first frame because there is no child to remove, what kind of condition would be best to handle this Also, when I click on the link twice for the same picture, it disappears, any reason for this Here is the code I'm using to load the picture: Code: function loadPic(fileName):void { var mainRequest:URLRequest = new URLRequest (fileName); mainLoader.load(mainRequest); mainLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, mainLoaded); } function mainLoaded(event:Event):void { mainPicArea.x = mainPicPlacementX; mainPicArea.y = mainPicPlacementY; mainPicArea.addChild(mainLoader); fadeIn = new Tween(mainPicArea, "alpha", Strong.easeOut, 0,1,.5, true); }
VIEWS ON THIS POST

52

Posted on:

Thursday 25th October 2012
View Replies!

Determining "context" for Portal APIs

I'm about ready to start distributing my game on some new portals (see my post in the Game forum to check it out). I don't want to fork the game for each portal, but I'd like to make use of the different portals' APIs (e.g., use Kongregate's scoreboard if the game is being played there, Nonoba's for there, MochiAds for elsewhere). How would you recommend detecting the "portal context" for my game without requiring compiling and maintaining a different version for each portal My current thinking is to put it in the loader and just maintain a different loader for each portal. Anyone else run into this problem and found a good solution
VIEWS ON THIS POST

52

Posted on:

Thursday 25th October 2012
View Replies!

removeChild() and timeline

Howdy , I have a MC on the stage that on the 30th frame traces a message. I use removeChild() and the MC is no longer visible, but it still seems to be running the timeline because the message continues to get traced. Is there something additional I need to do to completely destroy a MC
VIEWS ON THIS POST

35

Posted on:

Thursday 25th October 2012
View Replies!

removeChild errors

I am trying to create a movie clip by using a button in Flash. The button's instance is cir_btn which creates a circle on the stage I am using an external .as file to generate the public class Cir which calls upon several mouse actions as well as referrence a movie clip in my library that contains a shape. The movie clip's name is circle and it has a linkage of circle I am able to repeatedly generate circles inside of the swf, however when I try to use the remove button, this is what I get: ReferenceError: Error #1065: Variable circ is not defined. at Cir/::removeCirc() Here is the code for my .as file: package { import flash.display.MovieClip; import flash.events.MouseEvent; public class Cir extends MovieClip { var timeline:MovieClip; public function Cir(tl:MovieClip) { timeline=tl; timeline.cir_btn.addEventListener(MouseEvent.MOUSE _DOWN, onMouseDown); timeline.reset_btn.addEventListener(MouseEvent.MOU SE_DOWN, removeCirc); } public function onMouseDown( event:MouseEvent ):void { var circ:MovieClip = new circle; circ.x = 110; circ.y = 70; this.addChild(circ); } private function clicked(e:MouseEvent):void { removeEventListener(MouseEvent.CLICK,clicked); } private function removeCirc( event:MouseEvent ):void { parent.removeChild(circ); } } } Just to see if I was ever meeting the removeCirc function, I did both a trace and I changed the code from parent.removeChild(circ); to parent.removeChild(this); which does remove the circle from the stage, but I can't generate a new circle as long as I have the swf open. I am having a very hard time unlearning AS2 to learn AS3. Can any one help me out EXTRA CREDIT: I am also looking for a way to constrain the circle movie clip to a certain portion of the stage only. Some kind of bounds command so that the movie clip will only display in a rectangular area inside of the swf. This is not as important right now as figuring out how to remove the circle, but I will need to get to it eventually.
VIEWS ON THIS POST

121

Posted on:

Thursday 25th October 2012
View Replies!

removeChild 2ce -> error

I have a script which at some point MIGHT remove a child removeChild(obj[2]); At the end of script I need another script which has to remove the child if it is still present. I thought that if(obj[2]){ removeChild(obj[2]); } would do the trick. But even if it's removed in first part, then the second part still tries to remove it (it still sees obj[2] as TRUE) even though it already was removed from stage. Results in error ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. Am I doing something wrong here
VIEWS ON THIS POST

77

Posted on:

Thursday 25th October 2012
View Replies!

Performance tuning question : Where to declare your variables?

So I've been doing a little testing in a small, isolated case but I'm not yet sure whether this scales well. Maybe someone here already knows the answer. I had the feeling that declaring a variable, even if you never actually assign to it, is a process that costs cycles and as such if you are in a section of the code that is called frequently (at approx 1/60th of a second) that this common convention: Code: function update(delta:Number):void{ var importantNumber:Number; var importantInt:int; var importantObject:ImportantObject; var point:Point; } would perform worse than this uncommon convention Code: private var importantNumber:Number; private var importantInt:int; private var importantObject:ImportantObject; private var point:Point; function update(delta:Number):void{ // look ma', no declarations in the stack frame. } Very small-scale testing bears this out, but I'm curious whether this scales well. Would going the second route save you cycles on declaring variables while costing you in other ways (possibly in terms of cache misses) Has anyone here tried this out in a fully-fledged application or game
VIEWS ON THIS POST

48

Posted on:

Monday 29th October 2012
View Replies!

Update Native AS3 Classes?

Is there any way to update the native AS3 classes short of purchasing a newer version of Flash A native class has some additional functionality I'd like to use but do not have access to it currently (I am using CS4). A co-worker using CS5 does have access to the property. I'm not sure if it's relevant, but I'm trying access the backBufferLength property of the flash.net.NetStream class. Any idea
VIEWS ON THIS POST

42

Posted on:

Monday 29th October 2012
View Replies!

I need to know how to have points added to total score depending time.

Flash CS3 I need to know how to have points added or deducted to total score depending on the total time it takes to get around the track. I have my set variable called _root.total for the total score and my total time variable set as _root.totalTimeTXT But what do I do to have points added or deducted at the end of the game depending on the time it takes to get around the circuit. So for example if someone's total score is 19,076 and total time was 2:54:21 they would maybe have 200 points added or whatever score is easier to code..
VIEWS ON THIS POST

54

Posted on:

Saturday 10th November 2012
View Replies!

Having trouble with flash mp3 player

I am trying to create a streaming mp3 player that streams from a http server in flash. I can get it to work in flash when I debug it but when I publish it to see if it works live I get nothing. Here is the code that I am using can someone give me so advice on how to get this to work live.
VIEWS ON THIS POST

71

Posted on:

Monday 26th November 2012
View Replies!

Altering slideshow code

I could use some assistance altering jbum's slideshow code which is posted below \/ It works fine when I add the code to a new .fla movie on the first frame but I'm trying to load the slideshow coded movie .swf file into another .swf using loadMovie() and it's not working. I'm assuming that because I'm loading the Slideshow.swf movie into a movieClip in another movie using loadMovie() that the paths get messed up. Here's a general idea of the how I'm trying to do it: MAIN.swf------has a mc called "holder_mc" on it's _root timeline. SLIDESHOW.swf-------gets loaded into the "holder_mc" on "MAIN.swf" _root timeline. SLIDESHOW.swf has jbum's slideshow code in frame one, nothing else. Can anyone tell me what target paths to change (if that's the problem) or anything else that might help me get this to work I would really appreciate it.
VIEWS ON THIS POST

57

Posted on:

Friday 30th November 2012
View Replies!

Flash And Xml

I'm using the below script for an image slideshow in Flash that gets the image URL data from a xml-file. What I'm trying to do, is use the 'next' and 'previous' (highligted as BOLD) to load some additional Caption text for each image and send it to a dynamic text-field in Flash. Does anyone know how add the Text captions into the same xml file, so that the right text loads with the right image AND so that I can apply some simple formatting on the Caption texts (like Bold, Font size, Font color) spacing = 10; containerMC._alpha = 0; var pArray = new Array(); var tArray = new Array(); MovieClip.prototype.loadPic = function(pic) { containerMC._alpha = 0; cur = pic; this.loadMovie(pArray[pic]); this._parent.onEnterFrame = function() { var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded(); if (t != 0 && Math.round(l/t) == 1 && containerMC._width>0) { var w = containerMC._width+spacing, h = containerMC._height+spacing; border.resizeMe(w, h, pic); delete this._parent.onEnterFrame; } }; }; MovieClip.prototype.resizeMe = function(w, h, pic) { var speed = 3; this.onEnterFrame = function() { this._width += (w-this._width)/speed; this._height += (h-this._height)/speed; nav._x = Math.round(this._x-this._width/2); nav._y = Math.round(this._y+this._height/2+spacing/2); picinfo.info.text = tArray[pic]; picinfo._x = border._x-picinfo._width/2; if (Math.abs(this._width-w)
VIEWS ON THIS POST

40

Posted on:

Friday 30th November 2012
View Replies!

sending text data

, I'm building a small chat app in FMS development server 4.5 I want users to share messages with each other by using the remote sharedobject as the source. I know by using the sharedobject users can can send messages back and forth in real-time. However, i have lack of knowledge in as3. So, i am hoping for some advice to accomplish this or show me a link. Thank You
VIEWS ON THIS POST

38

Posted on:

Friday 28th December 2012
View Replies!

Flash Video Game Menu

This has been troubling me for some time now. I would LOVE to create a menu, on which I can scroll up and down and side to side threw out this menu, using the arrow keys. Every where I go, people have sweet turtorials on how to create these amazing menu's, but... you use your mouse to select the buttons and such. Now I did have a thought, perhaps just create a movie clip and when on key down just move it say, 20 px down soo i looks like it is moving to the next line of text, and when i do that just give a variable say, i called this variable currentSelection, and when i press (X) i read currentselection and go to that scene... Now i know this works, I have tried this myself, but i was wondering if there was a way i could do it, threw array's or like so i do not have to be soo specific. If this makes sense to anyone, or if you know of any tutorials out there, please! leave a reply It would be greatly apreciated!!! FlashByDefault
VIEWS ON THIS POST

63

Posted on:

Sunday 30th December 2012
View Replies!

3D Tool, Vector > Bitmap

When I use the 3d tool, my vector image looks/becomes a bitmap image. Is there a way I can still show it as vector when I publish it
VIEWS ON THIS POST

29

Posted on:

Sunday 30th December 2012
View Replies!

How to use setters? (Coin Collection)...

Someone told me that I had to use a setter...how would I implement that into my code! (I am fairly new to AS3) On my external AS file for the coin I have the following: package { import flash.display.MovieClip import flash.events.*; public class coin extends MovieClip { var player_mc:MovieClip; public static var coinsCollected:uint = 0; public function coin() { // constructor code this.addEventListener(Event.ENTER_FRAME,update); } function update (event:Event):void { player_mc=MovieClip(root).player_mc; if(this.hitTestObject(player_mc)) { coinsCollected += 1; this.removeEventListener(Event.ENTER_FRAME,update) ; parent.removeChild(this); } } } } And in the main movie I made a dynamic text box gave it an instance name of "score" and in my action script I wrote: score.text = String(coin.coinsCollected);
VIEWS ON THIS POST

82

Posted on:

Monday 31st December 2012
View Replies!

ProgressEvent.PROGRESS issue... it only shows when it is 100%...

, I am having issues with ProgressEvent.PROGRESS... I read somewhere that it might be some kind of problem with windows 7, but not sure... http://www.uploadify.com/forum/#/dis...n-windows-7/p1 So i came here for further help... It just doesnt work, there is not "progress" it only works when it is 100% done. Here is the code: Code: var assetLoader:URLLoader = new URLLoader(); assetLoader.load (new URLRequest("http://www.whatever/file.txt")); assetLoader.addEventListener (ProgressEvent.PROGRESS, progressHandler); function progressHandler (event:Event):void { var percentLoaded:Number = event.currentTarget.bytesLoaded/event.currentTarget.bytesTotal; percentLoaded = Math.round(percentLoaded * 100); trace("Loading: "+percentLoaded+"%"); txt.text = percentLoaded+" %"; } The funny thing is that it actually shows on the trace, but when i put it on the web, no progress showing the percentage loaded. Kind regards, Cheers, Leo.
VIEWS ON THIS POST

103

Posted on:

Monday 31st December 2012
View Replies!

Flash Tic Tac Toe Game

, Im creating a tic tac toe game using AS3 and I got the basic board down and placement I just can't figure out how to track who won I tried different tutorials but its not the same for my code. Im trying to make it as simple as possible. Here is the code : package { import flash.display.Sprite; import flash.events.MouseEvent; public class TicTacToeMain extends Sprite { var ticTiles:Array = new Array(9); var xTurn:Boolean = true; var oTurn:Boolean = true; var combos:Array = new Array(new Array(0, 1, 2), new Array(3, 4, 5), new Array(6, 7, 8), new Array(0, 3, 6), new Array(1, 4, 7), new Array(2, 5, 8), new Array(0, 4, 8), new Array(2, 4, 6)) public function TicTacToeMain():void { for (var i : int = 0; i < 3; i++) { for (var j : int = 0; j < 3; j++) { var curTile:TicTile = new TicTile(); curTile.x = j * curTile.width + j * 10 + curTile.width / 2 + 10; curTile.y = i * curTile.height + i * 10 + curTile.height / 2 + 10; addChild(curTile); curTile.addEventListener(MouseEvent.CLICK, takeTurn); curTile.overState = new xTile(); ticTiles.push(curTile); } } } public function takeTurn(evt:MouseEvent):void { evt.target.enabled = false; if (xTurn) { evt.target.upState = new xTile(); } else { evt.target.upState = new oTile(); } xTurn = ! xTurn; for each (var tile:TicTile in ticTiles) { if ( tile!= evt.target) { tile.overState = (xTurn) new xTile() : new oTile(); } } } } }
VIEWS ON THIS POST

40

Posted on:

Monday 31st December 2012
View Replies!