Please, help with Flash and PHP




Here I have a problem again.

I finished the game, and now needs to connect to a PHP script on the server.


It is about connecting the flash file with PHP script with the database.
These PHP files just accept the query string.

I'm interested in what and where I need to type, to make it all game work on the server.

My knowledge is very low,
and links to general use of functions and commands can not be much help.
You tell me step by step what to do, please...

I attached all files
Posted On: Thursday 3rd of January 2013 10:20:55 PM Total Views:  290
View Complete with Replies

RELATED TOPICS OF Flash / ActionScript PROGRAMMING LANGUAGE




Sprite.addChild Problem please help

Hi all. I am generating dynamic menus from an xml file. When I create movie clip buttons inside a for loop I am adding these to a sprite so that I can add child to the stage and chage its position. when I come out of this loop the sprite.numChildren is coming out to be 0 where as inside the loop if I trace it its comes out fine here is the code. var sprite:Sprite = new Sprite(); sprite.x = 50; sprite.y = 50 // generating movieclip menus for ( var i:int = 0; i < array.lenght;i++){ var menu:MenuClassMoiveClip = new MenuClassMovieClip(); menu.x = menu.width*i; sprite.addChild(menu); trace(sprite.numChildren); // gives 1,2,3 and so on depending on array lenght }// for (var j:int= 0; j < sprite.numChildren ; j++){ trace(sprite.numChildren); // nothing is traced even it does not enter into the for loop because sprite.numChildren is 0 }
VIEWS ON THIS POST

97

Posted on:

Thursday 25th October 2012
View Replies!

_please_ help me

i know this is a repost, but noone replied my previous post, so i'm begging for some help, at lease some tip... i've read about event propagation, even some explanations of senocular, but they're all mixed up... anyway, could someone please help me figure this out, i'm sure its not too complicated: I'm creating a video player and i want the interface (controls etc) to show up only when you roll over the video. i tried adding an event listener to the video object but ti wont work, so i added a transparent bg. to the controls, made it as big as the video, and added an event listener to that. It works good except one thing: when i roll over a control, it triggers the MOUSE_OUT event, and the controls hide... i'm guessing it has to do something with event propagation. Could anyone please help me out Very appreciated, Z
VIEWS ON THIS POST

118

Posted on:

Thursday 25th October 2012
View Replies!

help please about flv issue

hi everybody, im an actionscript 3 programmer, with some experience but im quite desperate with an issue that i cant solve, please help help, if you know the solution to my issue my email is ideami@gmail.com, thanks so much, i explain now * im building an application in which i have to show many flv videos dynamically, i have tried with both systems, with the FLVPlayback component being created dynamically and with the simpler netconnection and netstream etc way, the thing itself works no probs , the videos get created no probs at all, now the problem is that videos stop playing just after they start, or they play a few times and then they freeze or sometimes they dont even load at all, this happens both locally and remotelly * i read about the MIME video/x-flv issue, i have apache in my computer so i set the MIME right there and i still have the problem, so it doesnt seem that the MIME issue is the problem, even more: * first, to provide context, i have a PC with Windows Vista, and Flash CS3 Professional, and Flash CS3 Video Converter and Riva FLV Encoder, locally i have Apache and PHP installed, remotely a fasthosts server * i have found that if i encode the videos without audio! they almost always work, but here comes the desperating thing, if i encode them without audio, they always load, but they still freeze sometimes.... so if videos have audio, often they dont even load, if they dont have audio, often they work perfect and play, but still after playing 2 times maybe they freeze and they dont play more * i have executed my application in the flash environment, in a browser locally, locally in localhost through apache, and online in a fasthosts server; * i thought i had found something when i realized that if i encoded the videos with no audio they seemed to play well no probs, but i have found that even then they will freeze and stop moving after a while often * to encode i have tried many things! the Flash CS3 video encoder with different settings, and also the RIVA FLV Encoder * i have also , thinking that the kind of video source could be important, i have encoded a couple of different sources with same results, i encoded uncompressed AVIs and also wmvs please anybody can help, as im quite desperate with this, thanks very much, my email is ideami@gmail.com all best and thank you Jav
VIEWS ON THIS POST

77

Posted on:

Thursday 25th October 2012
View Replies!

Constructor in a class...please clarify.

all, I am trying to start making more object-oriented apps with Flash. But there is something I am having trouble understanding. When creating a class, what is a constructor Also, why does a class need a constructor Many
VIEWS ON THIS POST

77

Posted on:

Thursday 25th October 2012
View Replies!

dizzy from arrays, please help!


VIEWS ON THIS POST

150

Posted on:

Thursday 25th October 2012
View Replies!

Issue with AS3 RSS reader

Hi I am trying to develop a custom AS3 RSS reader. I have got to a point where I have traced the pubDate, description & title from each item of the feed. My issue is how do I then get this info to display in seperate MCs on the stage I can only display the last post in one MC rather all posts. Here is my AS... Code: var container_mc:MovieClip; var myTotal:Number; var myItem:XMLList; Font.registerFont(hattoriHanzo); var textBox:TextField = new TextField(); var textBox1:TextField = new TextField(); var textBox2:TextField = new TextField(); var format:TextFormat = new TextFormat(); format.size = 24; format.leading = 1; format.align = TextFormatAlign.LEFT; format.font = "Hattori Hanzo Light"; format.bold = true; format.color = 0x004964; format.letterSpacing = 2; textBox = new TextField(); textBox.defaultTextFormat = format; textBox.selectable = false; textBox.mouseEnabled = false; textBox.antiAliasType = AntiAliasType.ADVANCED; textBox.multiline = true; textBox.wordWrap = true; textBox.width = 400; textBox1 = new TextField(); textBox1.defaultTextFormat = format; textBox1.selectable = false; textBox1.mouseEnabled = false; textBox1.antiAliasType = AntiAliasType.ADVANCED; textBox1.multiline = true; textBox1.wordWrap = true; textBox1.width = 400; textBox2 = new TextField(); textBox2.defaultTextFormat = format; textBox2.selectable = false; textBox2.mouseEnabled = false; textBox2.antiAliasType = AntiAliasType.ADVANCED; textBox2.multiline = true; textBox2.wordWrap = true; textBox2.width = 400; var myXMLLoader:URLLoader = new URLLoader(); myXMLLoader.load(new URLRequest("http://www.onesg.co.uk/news/feed/")); myXMLLoader.addEventListener(Event.COMPLETE, processXML); function processXML(e:Event):void { var myXML:XML = new XML(e.target.data); myTotal = myXML.channel.item.length(); myItem = myXML.channel.item; callNews(); container(); } function callNews():void { for (var i:int = 0; i < myTotal; i++) { var myTitle = myItem[i].title; var myDate = myItem[i].pubDate; var myDesc = myItem[i].description; trace(myTitle); trace(myDate); trace(myDesc); textBox.text = myTitle; textBox1.text = myDate; textBox2.text = myDesc; } } function container():void { var container_mc = new MovieClip; container_mc.addChild(textBox); container_mc.addChild(textBox1); container_mc.addChild(textBox2); addChild(container_mc); } I hope my explanation makes sense.
VIEWS ON THIS POST

74

Posted on:

Monday 29th October 2012
View Replies!

Is there any benefit to loading External images over placing them all in the FlashIDE

I know there are a bunch of ways to benefit off of this, but in this scenario the only benefit I am looking for here is the time it takes to constantly troubleshoot. The end result won't matter, once the program is finished (images sitting in IDE or images loaded externally).. I work off of a laptop most of the time, cheap laptop, so if I have 5 Megs of images sitting in my Flash IDE, every time I troubleshoot (run the movie, F5), it takes at least 5 seconds before I can test my movie, and when you have to test it 4000 time a day it adds up . If I were to load everything externally, would this knock off the testing time drastically, considering I am not adding the images to the stage (just have them load, and stored in arrays) Ty!!
VIEWS ON THIS POST

139

Posted on:

Monday 29th October 2012
View Replies!

SWC question

Right now I have a .swf file I'm using to hold some fonts that I later upload and embed in a different project file. I know nothing about SWC files except that you can export them into your components folder for use. Is there a way to do this with my font file I'd like to get away from the getURL() method.
VIEWS ON THIS POST

74

Posted on:

Monday 29th October 2012
View Replies!

Load image from rss2?

Can anyone please show me how to load an image from this rss2
VIEWS ON THIS POST

79

Posted on:

Monday 29th October 2012
View Replies!

Flash Help building a game

Hi all! I'm building a simple game and I have a few problems that I can't figure out. I've attached the file if anyone would be so amazing as to check it out. 1. When you lose the game, it starts throwing errors non-stop until you close it. I've tried to put a removeEventListener in the game-over frame and it didn't solve it. 2. When you hit restart (and also when you hit start from the menu screen) the arrow keys stop working to move the car. They work the first time if you play it through without the stop(); action on the menu screen, so that it skips over it. But any button you press to start the game for the first or any other time, it makes the keys stop working. 3. I can't figure out how to display the end score on the game-over screen. But my score tracker is really ghetto.... I made an object off the stage that continuously increases in x location, and that location is the score. So I will try changing it to a counter with the time being the "score". But if you have any advice for then keeping it on screen to display where it stops, that would be helpful. Thank you so much
VIEWS ON THIS POST

69

Posted on:

Monday 29th October 2012
View Replies!

PHP url calls image - how can flash see this?

Hi So I have a php file, that has javascript within it only. When you call upon the PHP file, an image loads. How can I have flash, see this image Do I have to talk to the or PHP, or can I simply load that PHP URL which loads the image, and somehow have it load in flash
VIEWS ON THIS POST

206

Posted on:

Monday 29th October 2012
View Replies!

Interrupted Bandwidth during Video

My video player has a problem performing under bad bandwidth conditions. When i disconnect from my network halfway through playback this triggers a netstatus event with an info of "NetStream.Buffer.Empty".. If I reconnect my network, it doesn't start streaming again.. If I call netStream.resume() that triggers a "NetStream.Unpause.Notify" but the buffer never fills up and the video never plays again. Seems like once netstream runs out of internet juice and triggers a "NetStream.Buffer.Empty" there is nothing i can do to get playback to resume again. The only solution I can come up with right now is a separate class to monitor bandwidth and then manually trigger a new netStream.play followed by a netStream.seek to where the old playhead position was.. but that sounds really horrible to me. There must be a better solution
VIEWS ON THIS POST

92

Posted on:

Monday 29th October 2012
View Replies!

Flash Help!!

, I am a flash user who used old version in the past and purchased new flash CS4 professional come with Adobe design premium recently. Now my problem is when I tween two symbol I cannot see any tweening between. I have created keyframe1 and insert my graphic, then converted to symbol. Then I click on F6 at timeline 50 and create motion at middle. But I only can see the effect at keyframe 1 and key frame 50. I cannot see any slowly tweening effects at all. Do I did something wrong Guide me please...
VIEWS ON THIS POST

60

Posted on:

Monday 29th October 2012
View Replies!

Flash As3 Error Help and Refinement

So I know this is all really crappy codes and probably poorly done, but I need some help and clarification. DocumentClass: Code: package { import flash.display.MovieClip; import flash.ui.Keyboard; import flash.events.KeyboardEvent; import flash.events.Event; import flash.utils.Timer; import flash.events.TimerEvent; import Classes.Levels import Classes.GlobalVariables public class DocumentClass extends MovieClip { public var gameTimer:Timer; private var LevelActionScript; public function DocumentClass() { GlobalVariables.vars.character = new Character(); addChild( GlobalVariables.vars.character ); LevelActionScript = new Levels(); LevelActionScript.Levels(); /*gameTimer = new Timer(500); gameTimer.addEventListener( TimerEvent.TIMER, CharacterMovement ); gameTimer.start(); }*/ var leftKeyDown:Boolean = false; var upKeyDown:Boolean = false; var rightKeyDown:Boolean = false; var downKeyDown:Boolean = false; var mainSpeed:Number = 7; var mainJumping:Boolean = false; var jumpSpeedLimit:int = 15; var jumpSpeed:Number = jumpSpeedLimit; GlobalVariables.vars.character .addEventListener(Event.ENTER_FRAME, moveChar); function moveChar(event:Event):void { if (leftKeyDown) { GlobalVariables.vars.character .x -= mainSpeed; } if (rightKeyDown) { GlobalVariables.vars.character .x += mainSpeed; } if (upKeyDown || mainJumping) { mainJump(); } } stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown); function checkKeysDown(event:KeyboardEvent):void { if (event.keyCode == 37 || event.keyCode == 65) { leftKeyDown = true; } if (event.keyCode == 38 || event.keyCode == 87) { upKeyDown = true; } if (event.keyCode == 39 || event.keyCode == 68) { rightKeyDown = true; } if (event.keyCode == 40 || event.keyCode == 83) { downKeyDown = true; } } stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp); function checkKeysUp(event:KeyboardEvent):void { if (event.keyCode == 37 || event.keyCode == 65) { leftKeyDown = false; } if (event.keyCode == 38 || event.keyCode == 87) { upKeyDown = false; } if (event.keyCode == 39 || event.keyCode == 68) { rightKeyDown = false; } if (event.keyCode == 40 || event.keyCode == 83) { downKeyDown = false; } } function mainJump():void { if (! mainJumping) { mainJumping = true; jumpSpeed = jumpSpeedLimit * -1; GlobalVariables.vars.character .y += jumpSpeed; } else { if (jumpSpeed < 0) { jumpSpeed *= 1 - jumpSpeedLimit / 75; if (jumpSpeed > - jumpSpeedLimit / 5) { jumpSpeed *= -1; } } if (jumpSpeed > 0 && jumpSpeed = stage.stageHeight - GlobalVariables.vars.character .height) { mainJumping = false; GlobalVariables.vars.character .y = stage.stageHeight - GlobalVariables.vars.character .height; } } } } } } Levels: Code: package { import flash.display.Sprite; import flash.display.MovieClip; public class Levels extends MovieClip { //LEVEL VARIABLES //the current lvl var lvlCurrent:int = 1; /*The key for the level arrays: 1: Regular Block X: Main Character */ //this variable will hold the character var X:String = 'MAIN'; //the array for level 1 var lvlArray1:Array = new Array( 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 ); public function Levels() { //creating the level //this guy will hold all of the blocks var blockHolder:Sprite = new Sprite(); //then we add him to stage //current row that we are creating var row:int = 0; addChild(blockHolder); function createLvl():void { //getting the current level that we are on var lvlArray:Array = MovieClip(root)['lvlArray' + lvlCurrent]; //we have to find how far this level goes //this will be used so we know when to move to the next row //there will always be 16 rows, so this is how we find it out //of course, this will make the lvl formatting very strict var lvlColumns:int = Math.ceil(lvlArray.length / 16); //now we must create the level for (var i:int = 0; i
VIEWS ON THIS POST

44

Posted on:

Monday 29th October 2012
View Replies!

Inlining with #include

Doesn't #include directive provide a way of inlining code in actionscript What do you thing Discuss the merits and demerits.
VIEWS ON THIS POST

64

Posted on:

Monday 29th October 2012
View Replies!

Zendamf and zamfbrowser errors.

, I'm having some difficulties getting zamfbrowser to work. I'm running wamp to simulate a server locally. Whenever I try to to load a server I get the following error: Code: There was an error loading the server's info. Error: (mx.rpc.events::FaultEvent)#0 bubbles = false cancelable = true currentTarget = (mx.rpc.remoting.mxml::RemoteObject)#1 channelSet = (mx.messaging::ChannelSet)#2 authenticated = false channelIds = (Array)#3 [0] (null) channels = (Array)#4 [0] (mx.messaging.channels::AMFChannel)#5 authenticated = false channelSets = (Array)#6 connected = false connectTimeout = -1 enableSmallMessages = true endpoint = "http://localhost/codecreators/bootstrap.php" failoverURIs = (Array)#7 id = (null) mpiEnabled = false netConnection = (flash.net::NetConnection)#8 client = (mx.messaging.channels::AMFChannel)#5 connected = false maxPeerConnections = 8 objectEncoding = 3 proxyType = "none" uri = "http://localhost/codecreators/bootstrap.php" piggybackingEnabled = false polling = false pollingEnabled = true pollingInterval = 3000 protocol = "http" reconnecting = false recordMessageSizes = false recordMessageTimes = false requestTimeout = -1 uri = "http://localhost/codecreators/bootstrap.php" url = "http://localhost/codecreators/bootstrap.php" useSmallMessages = false clustered = false connected = false currentChannel = (mx.messaging.channels::AMFChannel)#5 heartbeatInterval = 0 initialDestinationId = (null) messageAgents = (Array)#9 [0] (mx.rpc::AsyncRequest)#10 authenticated = false autoConnect = true channelSet = (mx.messaging::ChannelSet)#2 clientId = (null) connected = false defaultHeaders = (null) destination = "AMF" id = "328E178B-3CB8-840A-2E11-390CB69C8174" priority = -1 reconnectAttempts = 0 reconnectInterval = 0 requestTimeout = -1 subtopic = "" concurrency = "multiple" convertParametersHandler = (null) convertResultHandler = (null) destination = "AMF" endpoint = "http://localhost/codecreators/bootstrap.php" getServices = (mx.rpc.remoting.mxml::Operation)#11 argumentNames = (Array)#12 arguments = (Object)#13 concurrency = "multiple" lastResult = (null) makeObjectsBindable = true name = "getServices" operationManager = (null) properties = (null) resultElementType = (null) resultType = (null) service = (mx.rpc.remoting.mxml::RemoteObject)#1 showBusyCursor = true makeObjectsBindable = true managers = (null) operations = (Object)#14 getServices = (mx.rpc.remoting.mxml::Operation)#11 requestTimeout = -1 showBusyCursor = true source = "ZendAmfServiceBrowser" eventPhase = 2 fault = (mx.rpc::Fault)#15 content = (Object)#16 errorID = 0 faultCode = "Client.Error.MessageSend" faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/codecreators/bootstrap.php'" faultString = "Send failed" message = "faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/codecreators/bootstrap.php''" name = "Error" rootCause = (mx.messaging.events::ChannelFaultEvent)#17 bubbles = false cancelable = false channel = (mx.messaging.channels::AMFChannel)#5 channelId = (null) connected = false currentTarget = (mx.messaging.channels::AMFChannel)#5 eventPhase = 2 faultCode = "Channel.Connect.Failed" faultDetail = "NetConnection.Call.BadVersion: : url: 'http://localhost/codecreators/bootstrap.php'" faultString = "error" reconnecting = false rejected = false rootCause = (Object)#18 code = "NetConnection.Call.BadVersion" description = "" details = "" level = "error" target = (mx.messaging.channels::AMFChannel)#5 type = "channelFault" headers = (null) message = (mx.messaging.messages::ErrorMessage)#19 body = (Object)#16 clientId = (null) correlationId = "2333034F-529D-D4FA-5CBE-390CB6D386BF" destination = "" extendedData = (null) faultCode = "Client.Error.MessageSend" faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/codecreators/bootstrap.php'" faultString = "Send failed" headers = (Object)#20 messageId = "7BBE1685-5ADD-3D15-A57A-390CC1A81AD1" rootCause = (mx.messaging.events::ChannelFaultEvent)#17 timestamp = 0 timeToLive = 0 messageId = "7BBE1685-5ADD-3D15-A57A-390CC1A81AD1" statusCode = 0 target = (mx.rpc.remoting.mxml::RemoteObject)#1 token = (mx.rpc::AsyncToken)#21 message = (mx.messaging.messages::RemotingMessage)#22 body = (Array)#23 clientId = (null) destination = "" headers = (Object)#24 messageId = "2333034F-529D-D4FA-5CBE-390CB6D386BF" operation = "getServices" source = "ZendAmfServiceBrowser" timestamp = 0 timeToLive = 0 responders = (null) result = (null) type = "fault" Any help would greatly be appreciated since I have no idea how to solve this and googeling has brought no help aswell. I also just cannot get zendamf to work on a server. It works perfectly on my local machine using wamp. But whenever I try it on a server I keep getting errors that the path towards the framework folder cannot be found. I'm using the following code: Code: folder setup is as followed: - frameworks - public - websites - *website* - application path
VIEWS ON THIS POST

89

Posted on:

Monday 29th October 2012
View Replies!

help/clean up

OK, don't be harsh as this is my first ever code in as3 --and I did it from scratch (I did look up stuff to find out about the 'event handlers' and 'beginfill stuff'). How would I go about cleaning it up Making it more dynamic Easier to edit PHP Code: stop()toolbar.shapeType.text='Rectangle'varnum:int=0varnames:Array=['Rectangle','Ellipse','Cirlce']vardragging:Boolean=falsevarsetVar:Boolean=falsevarmc:MovieClip=newMovieClip()vartemp:MovieClip=newMovieClip()varlevel:MovieClip=newMovieClip()varcolorTransform:ColorTransform=level.transform.colorTransform;stage.addChild(level)varlocationX:intvarlocationY:intvarlocation2X:intvarlocation2Y:intstage.addEventListener(MouseEvent.MOUSE_DOWN,mousedown);functionmousedown(evt:MouseEvent):void{dragging=truelocationX=evt.target.mouseXlocationY=evt.target.mouseY}stage.addEventListener(MouseEvent.MOUSE_UP,mouseup);functionmouseup(evt:MouseEvent):void{\t\tif(dragging==true)\t\t{\t\t\t\tdragging=false\t\t\t\tlevel.graphics.beginFill(0x00FFFF);\t\t\t\tswitch(num){\t\t\t\t\t\tcase0:\t\t\t\t\t\t\t\tlevel.graphics.drawRect(locationX,locationY,location2X,location2Y)\t\t\t\t\t\t\t\tbreak\t\t\t\t\t\t\t\t\t\t\t\tcase1:\t\t\t\t\t\t\t\tlevel.graphics.drawEllipse(locationX,locationY,location2X,location2Y)\t\t\t\t\t\t\t\tbreak\t\t\t\t\t\t\t\t\t\t\t\tcase2:\t\t\t\t\t\t\t\tlevel.graphics.drawCircle(locationX,locationY,location2X)\t\t\t\t\t\t\t\tbreak\t\t\t\t}\t\t\t\tlevel.graphics.endFill();\t\t}}stage.addEventListener(MouseEvent.MOUSE_MOVE,mousemoved);functionmousemoved(evt:MouseEvent):void{\t\t\t\tif(dragging==true){\t\t\t\tif(setVar==true)\t\t\t\t\t\tstage.removeChild(mc)\t\t\t\t{\t\t\t\tlocation2X=evt.target.mouseX-locationX\t\t\t\tlocation2Y=evt.target.mouseY-locationY\t\t\t\tmc=newMovieClip();\t\t\t\tmc.graphics.beginFill(0x00FFFF,.3);\t\t\t\tswitch(num){\t\t\t\t\t\tcase0:\t\t\t\t\t\t\t\tmc.graphics.drawRect(locationX,locationY,location2X,location2Y)\t\t\t\t\t\t\t\tbreak\t\t\t\t\t\t\t\tcase1:\t\t\t\t\t\t\t\tmc.graphics.drawEllipse(locationX,locationY,location2X,location2Y)\t\t\t\t\t\t\t\tbreak\t\t\t\t\t\t\t\tcase2:\t\t\t\t\t\t\t\tmc.graphics.drawCircle(locationX,locationY,location2X)\t\t\t\t\t\t\t\tbreak\t\t\t\t}\t\t\t\tmc.graphics.endFill();\t\t\t\tstage.addChild(mc);\t\t\t\tsetVar=true\t\t}}}stage.addEventListener(KeyboardEvent.KEY_UP,cancel);functioncancel(evt:KeyboardEvent):void{\t\tswitch(evt.keyCode)\t\t{\t\t\t\tcase32:\t\t\t\t\t\tdragging=false\t\t\t\t\t\tbreak\t\t\t\tcaseKeyboard.LEFT:\t\t\t\t\t\ttrace('shapes')\t\t\t\t\t\tif(num>0)\t\t\t\t\t\t{\t\t\t\t\t\t\t\tnum-=1\t\t\t\t\t\t}\t\t\t\t\t\ttoolbar.shapeType=names[num]\t\t\t\t\t\tbreak\t\t\t\tcaseKeyboard.RIGHT:\t\t\t\t\t\ttrace('shapes')\t\t\t\t\t\tif(num
VIEWS ON THIS POST

71

Posted on:

Monday 29th October 2012
View Replies!

BitmapData.histogram() explanation?

I've found some very useful ways to use BitmapData.histogram() however, I'm hoping someone can explain something proper terms/explanation for me. Let's assume I have a 100x100 GIF in Flash, it only contains Green (#00FF00) pixels and transparent pixels. When I trace myBitmapdata.histogram()[0][0] - I'm tracing the first index of the 255 item Vector for the Red Channel. Since there isn't any Red within my BitmapData - that first index reads 10,000. How can I explain that Would it be correct to say: "There are 10,000 pixels in this bitmap, and not one of them contains Red, hence it's returning 10,000" Here is a quick sample of what I'm trying to explain: http://lextalkington.com/ComparingImages.swf Hopefully this makes sense to someone, appreciate the help.
VIEWS ON THIS POST

89

Posted on:

Monday 29th October 2012
View Replies!

projectionCenter throws hittestobject off?

, wondering if anyone's run into the issue where assigning a new perspectiveProjection.projectionCenter to SpriteA throws off hitTestObject, like: SpriteA.hitTestObject(normalSprite); any thoughts
VIEWS ON THIS POST

101

Posted on:

Monday 29th October 2012
View Replies!

Google map: How to display Markers?

I'm having an issue to display markers into google map. I use XML to parse those markers. **Flash gives me that error msg: TypeError: Error #1009: Cannot access a property or method of a null object reference. However I can see Latitude and Longitude display while traced them... Does anyone can help me Code: package { import flash.display.Sprite; import flash.events.Event; import flash.geom.Point; import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import com.google.maps.controls.ZoomControl; import utils.LoadXML; import utils.ParseXML; public class GoogleMaps extends Sprite { private var loader:LoadXML; private var parser:ParseXML; private var tabMarkers:Array; private var map:Map; private static var FILE:String = "../xml/markers.xml"; private static var KEY:String = ""; public function GoogleMaps() { map = new Map(); map.key = "ABQIAAAAySpiyKFbR2kyvDyp02w_DhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTnKLUMs9zrkisTjGfTICBrTK1K2w"; map.setSize(new Point(stage.stageWidth, stage.stageHeight)); map.addEventListener(MapEvent.MAP_READY, onMapReady); addChild(map); loadXML(); } private function onMapReady(event:Event):void { map.setCenter(new LatLng(45.555255,-73.581336), 13, MapType.NORMAL_MAP_TYPE); map.addControl(new ZoomControl()); } private function loadXML() { loader = new LoadXML(FILE, handleLoadedXML); } private function handleLoadedXML(event:Event) { var markers:XML = new XML(event.target.data); parser = new ParseXML(markers); tabMarkers = new Array(); for each(var item:XML in markers.point) tabMarkers.push({ latitude:item.lat, longitude:item.long }); for(var i:int=0; i
VIEWS ON THIS POST

125

Posted on:

Monday 29th October 2012
View Replies!

Detect when a key was pressed - impossible?!

Hi. Im getting kinda frustrated as I try to come up with a simple way of telling when a key was just pressed... I've used both senoculars KeyObj class and the KEY_DOWN event, but i dont quite work as a would want the to work (if i press enter I get a zillions events - i just want ONE). How should I be handeling the problem
VIEWS ON THIS POST

65

Posted on:

Monday 29th October 2012
View Replies!

code structure/pattern tips?

I don't know if that's the right term, but... A couple months ago -- after working for many months on a very deep Flash video player (playlist, subtitles, advertising, tracking, embedding, deep customization, etc etc) -- I stumbled across something that *really* streamlined the code and made it much easier to work with & extend: I simply put the whole top-level playback logic into a loop. Code: private var currentStep:int = 0; private var playbackSequence:Array = [checkPoster, checkPrerollAd, checkBumper, playVideo, checkPostrollAd, checkEndOfLoop]; I then call a single function at the end of each iteration of the loop to continue on: Code: private function playbackLoop():void { currentStep++; playbackSequence[currentStep-1](); } And, of course, there's a function for each one of those items in the array which does things with more granularity. Anyway....this is something I sort of stumbled upon in large part by accident with the slow evolution of my understanding of coding, which means I spent a lot of time *not* doing it this way, wasting (arguably) lots of time and energy until I'd finally arrived here. SO, with that said, does anyone have any similar high-level tips like this to share Is there a good site or book that has a bunch of similar knowledge Is the best way to learn these things just to stumble across them yourself as needed I've seen game coding code patterns before, but never the same for different types of UIs and apps (menus, linear UI loops like above, etc).
VIEWS ON THIS POST

70

Posted on:

Monday 29th October 2012
View Replies!

Playbutton change after finished playing?

I have a simple Flash-player button (toggle play/stop) that plays MP3s. When I press play the MP3 starts and the button changes to stop. When I press again the music stops and the stop-button changes to play. I have several player-buttons on my page. How do I stop all sounds when I press play on one of the buttons As of now, I can start several MP3 at the same time and I don't want that. I've tried this: Code: import flash.media.SoundMixer; SoundMixer.stop(); but it doesn't work out. Do I need to number the players somehow Also, when the MP3 has finished playing it should turn into a play button. As of right now it's a stop-button when it's finished playing. How do I change it to a play-button This is the Actionscript 3 code: Code: var flashVars=this.root.loaderInfo.parameters; var loadSnd:URLRequest = new URLRequest(flashVars.myVar); var thisSnd:Sound = new Sound(); var sndTrans: SoundChannel = new SoundChannel(); thisSnd.load(loadSnd); play_btn.addEventListener(MouseEvent.CLICK,playF); stop_btn.visible = false; stop_btn.addEventListener(MouseEvent.CLICK,stopF); function playF(event:MouseEvent): void{ sndTrans = thisSnd.play(); play_btn.visible = false; stop_btn.visible = true; } function stopF(event:MouseEvent): void{ sndTrans.stop(); stop_btn.visible = false; play_btn.visible = true; }
VIEWS ON THIS POST

62

Posted on:

Monday 29th October 2012
View Replies!

Flash Is it possible to interact between classes?

I am kinda new to classes and trying to call a variable from different class. I mean, I define a PHP Code: publicvarquestionsAsked:String variable in Main.as and want to call it from another class. but It gives me Access of undefined property questionsAsked. I think I am missing a point.
VIEWS ON THIS POST

67

Posted on:

Monday 29th October 2012
View Replies!

Turn off throttle down/sleep mechanism in Flash Player 10.1?

I am wondering if any of you know of a way to turn the throttle down (sleep) mechanism off when a C++ app is hosting the flash activeX control. The flash control is invisible in this case and so the flash app will throttle down. Tinic Uro does not seem to be answering questions related to work arounds for apps that might not want flash to throttle down. This is especially annoying when you are hosting the flash control in your own application.
VIEWS ON THIS POST

63

Posted on:

Monday 29th October 2012
View Replies!

MVC package structure question

Forgive the slightly vague thread title, but I'm struggling with finding info on this because I can't seem to phrase my queries right. Simply: Usually I have separate packages for model, view and controller. This however presents a recurring dilemma. I want my controllers to be more intimate with the model than the views, because they should operate more directly on its data. Take for instance a scrollbar. The controller would take pixel values from the graphic elements and translate them into ratios for the model to store. It might be that the controller then needs access to properties in the model that I don't want exposed to the views. Having separate packages will force me to present the same interface to controllers and views, but I don't want to stuff all controllers in the model package and use the internal access modifier either, because then that becomes messy after a while. Anyone else pondered this question
VIEWS ON THIS POST

67

Posted on:

Monday 29th October 2012
View Replies!

same class within two swfs

Can I expect there to be any problems with using the same custom event class in two different swfs, and then using this class to dispatch these events from a loaded child swf to its parent wrapper swf If so, is there any better way to do this Should I instead be calling a public function in the parent wrapper (like a callback), and pass it the data that way instead If not -- if it will work perfectly fine -- will I ever have to worry about changing code within any of the *other* classes, and recompiling one or the other (either parent of child) separately
VIEWS ON THIS POST

102

Posted on:

Monday 29th October 2012
View Replies!

Help with particle collision issue please!

i've just recently picked up learning as3 and was doing some practice via making random things, I ended up making a program that generates particles at the location of your mouse when you click and sends them flying in random directions. I tried making them bounce off of the stage perimeters but instead a small "box" was created around the mouses location that contains all of the particles... sorry for the long winded explanation i'm just trying to give as many detals as possible heres the code Code: package { import flash.display.*; import flash.events.*; public class colorRandom extends MovieClip { private var my_MC:MovieClip; private var index:Array; private var i,r,maxParticles, left, top, right, bottom:Number; public function colorRandom(rootMovie:MovieClip) { my_MC = new MovieClip(); index = new Array(); maxParticles = 100; top = rootMovie.parent.height - rootMovie.parent.height; left = rootMovie.parent.width - rootMovie.parent.width; right = rootMovie.parent.width; bottom = rootMovie.parent.height; rootMovie.addChild(my_MC); rootMovie.parent.addEventListener(MouseEvent.MOUSE_DOWN, explosion); addEventListener(Event.ENTER_FRAME, moveParticles); } private function explosion(parent){ createParticles(); maxParticles = 100; } private function moveParticles(e:Event){ for(i = index.length -1; i > 0; i--){ index[i].x += index[i].pX; index[i].y += index[i].pY; if(index[i].y = 50){ index[i].pY = index[i].pY * -1; index[i].pY = index[i].pY * 0.7; } index[i].life --; if(index[i].life 0){ var particlebase:particleBase = new particleBase(); var particle:Shape = new Shape(); particlebase.life = 40; particlebase.pX = (Math.random()*10) - (Math.random()*10); particlebase.pY = (Math.random()*10) - (Math.random()*10); if(Math.abs(particlebase.pY)
VIEWS ON THIS POST

104

Posted on:

Monday 29th October 2012
View Replies!

Variable question

This is a question I've been wondering about for a while ... If I have a variable like this: var sw:Number = stage.stageWidth; and I need to use "sw" or stage.stageWidth a number of times, is my code then better optimized if I only write "sw" or might I as well write stage.stageWidth all the time I mean, I know it's easier to just write "sw" but does flash "figure my code out" faster if I've already defined what the stageWidth is once (sw). Hope you understand my question,
VIEWS ON THIS POST

73

Posted on:

Monday 29th October 2012
View Replies!

Flex Flex or Flash?

I can't decide what i want to use. I've made an admin page using flex adding FAQS to a database plus some other little options. but for the user i want a FAQS search app. I initially thought i would use flex, but i've come to the conclusion Flex is only quick when using the built in components. To me flash would be easier to create an app where i could control how things will visually appear.... For example in Flex would it be just as easy in flash if I were to NOT use "lists" and "datagrids" What if i want to have a "skinless" expand and collapse type menu , i just want to be able to get at information in my class. so right now im using the UIcomponent for my custom class.. sorry there is not much documentation on this, or I dont understand any of it.
VIEWS ON THIS POST

47

Posted on:

Monday 29th October 2012
View Replies!

Incorrect # of args

So, I've come across 2 problems I'm unable to solve by myself. The first one is from a project in which my aim is to develop an RPG game engine, right So I've been working on a system handling inventory, since you're supposed to handle things in a game, else the game would suck. So the current functionality is that I've got the Inventory-script, handling stuff like hiding/showing the backpack, adding and removing stuff from it etc. Plus I've got the "coolSword" item and class to symbolize an item, and the "Backpack" item and class to solidify a backpack. Some of this will get switched out to more dynamc counterparts during development, but that isn't very relevant at the time being. My problem is the following: I have got a function that, when a certain key is pressed, puts a backpack on the stage, "openBackpack". I have also got a function which removes a sword thumbnail from the stage, add's a sword thumbnail to the backpack-mc, and all of this i working great. The only problem being that when i fire my thumbnail-function, I want it to remove thumbnail from the stage, add it to the Backpack and then call the openBackpack-function. Though when I add "openBackpack" I return; 1136: Incorrect number of arguments. Expected 1.
VIEWS ON THIS POST

38

Posted on:

Monday 29th October 2012
View Replies!

Receive an array from PHP

, i already figured out how i can send an array from as3 to php with the toString() method. Now i'm looking for the solution to how do I receive an array from php. I would like to print an array and access it inside my actionscript file as an array Is there a way to parse it Thank you very much for the help.
VIEWS ON THIS POST

49

Posted on:

Friday 30th November 2012
View Replies!

action script

i have an image, i have to cut in four pieces and convert in movie clip, In four movie clip I insert tween clock wise upto 300 frames and piot is centerise. My Question is how can We add event when mouse roll over one of them and all motion is stopped and roll out old position Second Question is, how can i mouse over one of them and alpha reduce 30% Third Question is when mouse clicked on one piece of movie clip alpha is set 30% ,even mouse over or not and open a small dynamic text in center of movie clip In circular movie clip name is logo_mc and code are: btn1_mc.onRollOver = function(){ this._alpha = 30; }; btn1_mc.onRollOut=function(){ this._alpha=100; }; /*btn1_mc.onRelease=function(){ this._alpha=60; };*/ btn1_mc._alpha btn2_mc.onRollOver = function(){ this._alpha = 30; }; btn2_mc.onRollOut=function(){ this._alpha=100; }; btn2_mc._alpha btn3_mc.onRollOver = function(){ this._alpha = 30; }; btn3_mc.onRollOut=function(){ this._alpha=100; }; btn3_mc._alpha btn4_mc.onRollOver = function(){ this._alpha = 30; }; btn4_mc.onRollOut=function(){ this._alpha=100; }; btn4_mc._alpha and main time script are : play(); logo_mc.onRollOver = function(){ stop(); }; logo_mc.onRollOut = function() { play(); }; logo_mc.onRelease=function():Void { loadVariablesNum("bsrc1.txt",0); best regards Attached image(s)
VIEWS ON THIS POST

51

Posted on:

Friday 30th November 2012
View Replies!

Making it Loop

I'm trying to get this thing to loop or to start back at the beginning. var i:Number = 1; function DoRandom() { var target_x = home_x - content_mc["section_"+i]._x; content_mc.slideTo( target_x, "0", 2 ); i++; if(i==6) var target_x = home_x-content_mc.section_0._x; content_mc.slideTo(target_x,"0",2); if(i==1) var alphaT:Tween = new Tween(b_0, "_alpha", Regular.easeOut, 50, 70, 1, true); if(i==2) var alphaT:Tween = new Tween(b_0, "_alpha", Regular.easeOut, 50, 50, 1, true); if(i==2) var alphaT:Tween = new Tween(b_1, "_alpha", Regular.easeOut, 50, 70, 1, true); if(i==3) var alphaT:Tween = new Tween(b_1, "_alpha", Regular.easeOut, 50, 50, 1, true); if(i==3) var alphaT:Tween = new Tween(b_2, "_alpha", Regular.easeOut, 50, 70, 1, true); if(i==4) var alphaT:Tween = new Tween(b_3, "_alpha", Regular.easeOut, 50, 70, 1, true); if(i==4) var alphaT:Tween = new Tween(b_2, "_alpha", Regular.easeOut, 50, 50, 1, true); if(i==5) var alphaT:Tween = new Tween(b_4, "_alpha", Regular.easeOut, 50, 70, 1, true); if(i==5) var alphaT:Tween = new Tween(b_3, "_alpha", Regular.easeOut, 50, 50, 1, true); if(i==6) var alphaT:Tween = new Tween(b_4, "_alpha", Regular.easeOut, 50, 50, 1, true); if(i==6) var alphaT:Tween = new Tween(b_0, "_alpha", Regular.easeOut, 50, 70, 1, true); } var intervalID = setInterval(DoRandom, 4000); Can anyone tell me how to make it loop
VIEWS ON THIS POST

48

Posted on:

Friday 30th November 2012
View Replies!

movie clip movement

Ok, I'm making a game and I'm having trouble moving my bullet. It's a sky view defend this base type game and I have my character moving with keyboard commands and tracking my mouse. I want to shoot a bullet and have it travel through where the mouse was pressed. Here's what I have so far. function bullet(){ var thebullet:Object = new Object(); thebullet.onmousedown = function(){ attachMovie("bullet", "bullet25", 35); bullet25._x = player1._x; bullet25._y = player1._y; trace(bullet25._x); trace(bullet25._y); bullet25.onEnterFrame = function(){ } } if (bullet25.hitTest(uber)){ reset(); } Mouse.addListener(thebullet); } function target(){ var theTarget:Object = new Object(); Mouse.hide(); theTarget.onmousemove = function(){ attachMovie("mousetarget", "mousetarget", 30); mousetarget._x = _xmouse; mousetarget._y = _ymouse; } Mouse.addListener(theTarget); } function player(){ attachMovie("player1", "player1", 24); player1._x = 200; player1._y = 200; player1._width = 25; player1._height = 45; keystroke(); } function keystroke(){ var DISTANCE:Number = 3; var keyListener_obj:Object = new Object(); keyListener_obj.onkeydown = function() { switch (Key.getCode()) { case Key.LEFT : player1._x -= DISTANCE; break; case Key.UP : player1._y -= DISTANCE; break; case Key.RIGHT : player1._x += DISTANCE; break; case Key.DOWN : player1._y += DISTANCE; break; case Key.DOWN + Key.LEFT : player1._x -= DISTANCE; player1._y -= DISTANCE; break; case Key.UP + Key.LEFT : player1._x -= DISTANCE; player1._y += DISTANCE; break; case Key.RIGHT + Key.UP : player1._x += DISTANCE; player1._y += DISTANCE; break; case Key.DOWN + Key.RIGHT : player1._x += DISTANCE; player1._y -= DISTANCE; break; } } Key.addListener(keyListener_obj); } In my "player1" movie clip I have this code: onEnterFrame = function() { myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x); // Calculates the mouse angle in radians myDegrees = Math.round((myRadians*180/Math.PI)); // Converts the mouse angle to degrees so it can be expressed in _rotation terms this._rotation = myDegrees+90; // Turns the MC to face the mouse }
VIEWS ON THIS POST

72

Posted on:

Friday 30th November 2012
View Replies!

random graphics

I am trying to make an intro page using flash. I have a spotlight that bounces off the sides of the virtual "walls". I want random graphics to appear in the spotlight with a pause between each graphic. How can I do this
VIEWS ON THIS POST

95

Posted on:

Friday 30th November 2012
View Replies!

When mc hits stage boundary - transfer to opposite edge

I have an mc which moves on pressing buttons. I want it to come to the left of the stage if it hits the right end. Simple, isn't it But I want to have one move thing done. I want only that part of the mc to come to the left which has hit the boundary. For example, Let this be the mc- Code: ---- | | | | ---- When half of it hits the right end, only half should be transferred to the left end. Code: -- -- | | | | -- -- Please help.
VIEWS ON THIS POST

60

Posted on:

Friday 28th December 2012
View Replies!

Flash MovieClip Class

, I am new to action script 3.0 and i have been reading the tutorial about MovieClip classes on kirupa.com, and i learned a lot from it. Yet i have a question about doing a movieclip button class that does roll_over and roll_out function I need that mostly because of understanding how the class work and if that Is anyhow possible and if it is, i would appreciate someone explaining to me an example of doing such thing. More precisely, i need to know a process of tweening a button via class, so that on roll over it does tween i have entered via code and on roll_out other kind of a tween
VIEWS ON THIS POST

45

Posted on:

Sunday 30th December 2012
View Replies!

AIR Unable to play the current frame actionscript 3

I have a problem on playing the current frame. which means to replay the frame. I have need to play back the frame 5, however it end up on playing the frame 6 which is the next frame. I couldnt brain this as I am stuck! Helppp function reset(event:MouseEvent):void { gotoAndPlay(5); }
VIEWS ON THIS POST

70

Posted on:

Sunday 30th December 2012
View Replies!

Help with Bullet ricochet!

Ok i made a tank that can move and shoot but i want the bullet to bounce or "ricochet" off the walls so i gave it a shot but.. the bullet bounces off the wall but after i shoot a couple they all suddenly are in sync heres my code.. PHP Code: functionmouseDown(pEvent){\t\tif(amo>=1)\t\t{\t\t\t\tvarb=newBullet();\t\t\t\tb.x=myTank.x;\t\t\t\tb.y=myTank.y;\t\t\t\tamo-=\t1;\t\t\t\tb.angleRadian=Math.atan2(mouseY-myTank.y,mouseX-myTank.x);\t\t\t\tb.addEventListener(Event.ENTER_FRAME,bulletEnterFrame);\t\t\t\taddChild(b);\t\t}}functionbulletEnterFrame(pEvent){\t\t\t\tvarb=pEvent.currentTarget;\t\tb.x+=\tMath.cos(b.angleRadian)*speed;\t\tb.y+=\tMath.sin(b.angleRadian)*speed;\t\tb.rotation=b.angleRadian*180/Math.PI;\t\tif(b.y
VIEWS ON THIS POST

251

Posted on:

Sunday 30th December 2012
View Replies!

Culling system design.

I thought up this way to design the culling system for the static objects in my game. I want the best in speed so I have to avoid any array searches. I want all direct row/col lookups. My tileMapClass dispatches events whenever tiles are removed/added as it manages the rendering of the base tile map as the scene camera moves. When the event is dispatched from the tileMapClass as it add/removes visible tiles the parent gameClass reacts to that event by passing the changed tile row/col array to the staticObjectsClass from the tileMapClass. Any other class that will need the info will also get it... Then those classes do any changes needed to the objects on those tiles. Edit: Note, the tile updated arrays are also sent in the proper update order and with a variable to sort the depths properly too. What I am also unsure about is how to manage culling of moving npc's/units. Maybe all moving objects should keep their row/col position registered on a multi-dimensional Vector. Distance based culling is very inefficient with large maps and very large numbers of npc's. I should probably have off screen npc's/units just moving from cell to cell on their paths with a time calulation. Unless they come on screen... Then it shows the animation and switches to doing higher processor cost frame to frame movement.
VIEWS ON THIS POST

45

Posted on:

Sunday 30th December 2012
View Replies!

Please review how I want to do masking

I can't try this at the moment, but I would like to know if this is the way to do it. So here is the scenario: I am developing a standalone app that is composed of modules. A module is a sprite container that contains other sprites or movieclips. Pure AS3, design was made with the IDE and exported as SWF. In one module, I have a curved background that is loaded from an SWF. On this curved background I have other modules loaded that are displayed with an alpha tween and they are fully on the background, they don't move. But I have two modules that have a rectangle base bigger than the height of the curved background and I want to motion tween them on the curved background in a way that the parts hanging off the curved background are masked. So the Z order and hierarchy would be like this: ------ sprite container parent curved backgroundmodule 1 (staying inside background)module 2 (inside)module ... (inside)bigger rectangle module that need to be masked and motion tweened inMy solution would be: load another instance of the curved background to use it as a mask.add this mask to the display list as a child of the "sprite container parent"keep this mask on the top of all modules(\t not sure about this)position the mask exactly as the curved backgroundload the module that I want to mask and position it outside of the visible stageadd the mask on the module that need to be masked.motion tween the module to the visible areaWhat I am not sure about: even if the mask is not child the module to be masked, will it move with the module that is tweened (I want the mask to stay still)I want every other display object to be visible under the mask, only the masked module should be masked (this is obvious I guess
VIEWS ON THIS POST

172

Posted on:

Thursday 3rd January 2013
View Replies!

Resize handler randomly works?!

Hi all. I have a main swf which I load in a few different external swf. For each of the external swf I have resize handlers which make sure my loaded swf are position in the correct place when window is resized. It works almost perfect.. but let say 1 out of 4 times the resize handler stops and nothing happens. Why does it sometimes work only I know I should not have function within a function but in this case I do not know how to do it in any other way! I have attached the code for one of the functions: Thankful for all advice. Code: function eventsLoaded(event:Event):void { mcExt = MovieClip(contentLoader.contentLoaderInfo.content) loadedMovieClip="events"; preloader_mc.visible = false; this.stage.addEventListener(Event.RESIZE, resizeEvent, false,0,true); eventsBG_mc.width = stage.stageWidth; eventsBG_mc.height=stage.stageHeight; eventsBG_mc.x=stage.stageWidth; contentLoader.x=stage.stageWidth; contentLoader.y=stage.stageHeight/2-contentLoader.height/2; addChild(eventsBG_mc); addChild(contentLoader); var timeline:TimelineLite = new TimelineLite(); timeline.append( new TweenLite(contentLoader, 1, {x:305, ease:Sine.easeOut}) ); timeline.append( new TweenLite(eventsBG_mc, 1, {x:305, delay:-1, ease:Sine.easeOut}) ); //resize handler function resizeEvent(){ eventsBG_mc.height=stage.stageHeight; contentLoader.y=stage.stageHeight/2- contentLoader.height/2; } }
VIEWS ON THIS POST

336

Posted on:

Thursday 3rd January 2013
View Replies!