SEARCH YOUR SOLUTION HERE  

controlling an object placed by a class

sorry if duplicated...
i have two movieclips on stage, one load as a class an mc with animation, the other load a button...how can i send the message, comunicate both clases to let the button start the animation

Posted On: Friday 12th of October 2012 04:41:50 AM Total Views:  165
View Complete with Replies




Related Messages:

how do I uninstantiate an object?   (75 Views)
I have a slide show that runs from the moment it's instantiated. When I stop it I remove from stage and set to null. I thought that setting it to null would remove it from memory but I was wrong it keeps outputting trace output until I close the swf. Code: import com.droolpigs.*; var slideshow:Slideshow; start_btn.addEventListener(MouseEvent.CLICK, startIt); stop_btn.addEventListener(MouseEvent.CLICK, stopIt); function startIt(e:MouseEvent):void { slideshow = new Slideshow(); addChild(slideshow); } function stopIt(e:MouseEvent):void { removeChild(slideshow); slideshow=null; // trace output and memory usage tells me it's still running and loading slides }
Determine object triggering an event?   (76 Views)
! I am having an issue where I am unable to make my script determine which button in my menu is triggering the event (MOUSE_UP). I came pretty close to success by finding the "target" property but its not reliable if I have clips within my button. If anyone could give me the solution to that problem it would be nice Looked around and couldn't find an answer. Thank you! The animation is not done yet also. Code: package { import flash.display.*; import flash.events.Event; import flash.events.TimerEvent; import flash.events.MouseEvent; import flash.utils.Timer; import flash.text.TextField; import flash.text.TextFormat; public class createMenus extends Sprite { var i:Number; var menuArray:Array = new Array("Menu 1", "Menu 2", "Menu 3", "Menu 4", "Menu 5") var nbMenus:Number = menuArray.length; static var clip:Number = 1; public function createMenus() { for(i=1;i
Flash Browser back button reloads entire movie - shared object?   (85 Views)
, I have trailed through endless forums and tried adding all the various codes people have given to try but with no luck. I would be so forever grateful if some bright person out there could help I have a movie that is embedded within a php page. The movie starts with an animation and at the end, an image emerges with buttons. The image that emerges is actually an xml run slideshow but I don't want to complicate it with this bit of information if it is not relevant. So the film stops there and the buttons remain with a changing background. I would like to make it skip to the end frame if it has been played before, if someone returns to the page, so that the user doesn't have to watch the entire movie to get to the buttons. I have tried adding this to the first scene however it is pretty temperamental: var myCookie:SharedObject = SharedObject.getLocal("checkFirstVisit"); if (_root.getBytesLoaded() == _root.getBytesTotal()) { // Flash Cookie if (myCookie.data.didAlreadyVisit) { _root.gotoAndPlay(505); } else { myCookie.setProperty('didAlreadyVisit', true); gotoAndPlay(2); } } else { gotoAndPlay(1); } PLEASE help!
Flash AS3 Access stage variables from class object   (90 Views)
I was wondering if there is a simple way to access variables from a class object, where the variables are not actually a part of that class. So if you had an array defined on the first frame of the stage, and added some elements to it, you could use the methods of the custom class to manipulate the array's data. Stage Frame 1 Code: var myArray:Array = new Array( "apple", "banana", "pear" ); var myClass:someFunctions = new someFunctions(); myClass.addValue( "orange" ); myClass.sortValues(); someFunctions.as Code: package{ public class someFunctions{ public function someFunctions(){ } public function addValue():void{ //add an element to the array } public function sortValues():void{ //sort the values in the array } } } It might not seem logical as to why you would ever want to do that, but it's a very simple example, and it's the means I'm after, not the result. I'm creating a list of functions available to execute by a user via an input field. To keep things simple I made them the methods of a class. The issue, however, is that these methods need to manipulate objects which are on the stage, added and removed by a separate controller class. Passing the objects by reference to the class as a parameter would not be viable with what I'm trying to do either. Any ideas
Flash Convert XML to Array of objects   (79 Views)
I found a good class to convert XML to Array of Objects just like SimpleXMLSecoder do in flex. The problem is the class does not convert it to array if there is only 1 node. I tried to modify it without success. Please can someone help me with this. Attached are the source files. e.g. PHP Code: importeu.rotundu.xml.*;vars:SimpleXMLDecoder=newSimpleXMLDecoder(true);/*varlist:XML= ;*/varlist:XML= ;varresult:XMLDocument=newXMLDocument();result.ignoreWhite=true;result.parseXML(list.toString());varo:Object=s.decodeXML(result.firstChild);trace(o.book.length) The above code returns length if I use the commented list. I want to create 0 index Array if there is one element only.
HELP: how to highlight the active object while deselecting others   (69 Views)
i have an array made of movieclip squares named "quiqua" that are positioned in a grid with coordinates (grouped into another array named "coo"). Both the arrays have a numeric variable named saturaz. when i click on the coordinates i want to highlight that coordinate and select only the elements which fit with the "saturaz" value. It works fine but I can't figure out how to tell Flash to highlight just a coordinate (and the squares that match with that value) at a time. This is the code. HELP ME OUT. Code: var quiqua:Array = [rosa, blu, viola, giallo]; var coo:Array = [sat_sessanta, sat_settanta]; var saturaz = uint; coo[0].saturaz=60; coo[1].saturaz=70; quiqua[0].saturaz=60; quiqua[1].saturaz=80; quiqua[2].saturaz=60; quiqua[3].saturaz=70; for (var e:int = 0; e < coo.length; e++) { coo[e].addEventListener(MouseEvent.CLICK, evidenzia_fisso); coo[e].alpha = 0.4; } function evidenzia_fisso(event:MouseEvent):void { for (var i:int = 0; i < quiqua.length; i++) { if (quiqua[i].saturaz != event.currentTarget.saturaz){ quiqua[i].alpha = 0.2; event.currentTarget.alpha = 1; } } }
Date object September is missing?   (77 Views)
Hi ! Can somebody explain why the month September is not working in my example var $date = new Date(); $d.setMonth(7); trace($d); // Tue Aug 31 12:10:29 GMT+0200 2010 $d.setMonth(8); trace($d); // Fri Oct 1 12:10:29 GMT+0200 2010 makes no sense
Problem controlling an embedded SWF   (160 Views)
everybody! I'm having some trouble with a video (FLV) that I am trying to play while inserting an other layer above it. I want my output SWF file to contain the whole video inside. The only method of doing so was to convert the FLV file into a SWF file, and embedding the SWF: [Embed(source="file.swf")] The embedded video is uncontrollable. I can't stop or mute the embedded swf.... Even before adding it to the stage, the video's sound is heard. Am I doing something wrong Could there be a different method to embed a FLV file so my output SWF file will contain it (and there won't be a need to load it through a URL).
controlling divs in dreamweaver with flash buttons   (159 Views)
Hi all, thanks in advance for your help. This is the situation: I have created a website in Dreamweaver and it functions entirely upon hiding/showing divs, using the appropriate behavior (very basic html knowledge on my part So it's just one page in which layers are alternatively hidden and shown. I have created a set of flash buttons (they are all in one file, because a very basic Flash animation is supposed to make them fade in one by one when another flash button inserted in the html page is activated). Now, I have two problems regarding this: 1. On page load, this "animation" (the buttons which fade in successively one after another) appears automatically, even though it is located inside a div which is invisible by default and should only be visible at the trigger of a button. This is not acceptable for me because it is a submenu which should be invisible at first. 2. Let's suppose item #1 is resolved. Different html divs are supposed to appear/be hidden when rolling over each of these Flash buttons, and I haven't been able to find out how to do this. I know I should work with the Flash code in order to do this, "on (rollover) {//no idea what to place here to call the Javascript function from dreamweaver which I don't know how to create, if it's not applied directly to an object//} So if anyone can help me out with this, I'd really appreciate it! Don't hesitate to ask for clarifications... thanks! ps: This is the site: www(dot)wise-ls(dot)comlu(dot)com (I'm working on expanding the width, that's why it looks funny The section in question is "soluciones", and what I want to do is replace the text links with Flash buttons.
AS3:KEEP DYNAMIC BUTTONS DOWN when controlling image galle   (196 Views)
, please help me on this last part of my project. I'm sure it's really simple but I can't seem to figure it out: I have dynamically loaded buttons (thumb) and images (galImage) going to container_mc and full_mc containers respectively. I can't get the buttons to stay down when pressed using MOUSE_DOWN and MOUSE_UP. When I use CLICK instead, they all stay pressed. Please help! //Load Gallery Images and Thumbs for (var i:Number = 0; i < sub_menu1.selectedItem.gallery.length(); i++) { //Load Gallery Images var galImage:Loader = new Loader(); var galUrl = sub_menu1.selectedItem.gallery[i]; galImage.load(new URLRequest(galUrl)); //Create Thumbs var thumb = new ThumbButton(); thumb.image = galImage; thumb.name = i; thumb.y = 20*y_counter; thumb.buttonMode = true; thumb.graphics.lineStyle(1,0xFFFFFF); thumb.graphics.beginFill(0xFFFFFF,0); thumb.graphics.drawRect(0,0,15,15); thumb.graphics.endFill(); y_counter++; //Add Thumbs to Container container_mc.addChild(thumb); thumb.addEventListener(MouseEvent.MOUSE_DOWN, showFull); thumb.addEventListener(MouseEvent.MOUSE_UP, stayClear); function stayClear (ev:Event):void { ev.target.graphics.clear(); ev.target.graphics.lineStyle(1,0xFFFFFF); ev.target.graphics.beginFill(0xFFFFFF,0); ev.target.graphics.drawRect(0,0,15,15); ev.target.graphics.endFill(); } function showFull (evt:Event):void { full_mc.x = 420; full_mc.y = 100; full_mc.addChild(evt.target.image); evt.target.graphics.lineStyle(1,0xFFFFFF); evt.target.graphics.beginFill(0xFFFFFF,1); evt.target.graphics.drawRect(0,0,15,15); evt.target.graphics.endFill(); }
controlling an external SWF   (196 Views)
I can't find a way to control an external SWF in AS3 like I used to be able to in AS2. This used to be a real simple way (among others) in AS2: loadMovieNum("yourMovie.swf",1); onMouseDown = function(){ _level1.stop(); } onMouseUp = function(){ _level1.play(); } Unfortunately this has been abolished in AS3 . To load a SWF externally from a separate SWF file (on a separate CPU) in AS3, you now must now use a URL request along with a load request. However, the SWF is tied into this loader object of which's class does not contain "play", "stop", "currentFrame", "nextFrame", "prevFrame", "gotoAndPlay", "gotoAndStop", etc..... According to the help panel, you can target any of the loader's child's methods by virtue of calling "loader.content".... but it doesn't work. When I trace my "loader.content".... all I get back that it is an [Object Main Timeline] when I would expect it to be [Object MovieClip] if it were to have the methods I need. Inevitably.... I need to do all sorts of gotoAndStop / gotoAndPlay functionality with external SWFs on another CPU. I have a nice XML server running successfully... I just hit this brick wall.... any suggestions thx
controlling a movieclips timeline from within itself   (214 Views)
Greetings. How do I control the timeline from a movieclip from within itself I made a menubutton for a school assignment. To make it, I created a movieclip of the button's graphic, with on the second frame the button again but with the menu open (haven't added anything in it yet). Opening the menu is as easy as Code: menu_mc.addEventListener(MouseEvent.CLICK,openMenu); function openMenu(evt:Event):void{ this.menu_mc.gotoAndStop(2); } Inside of the menu is a CLOSE button (just a movieclip) that should, when clicked, take menu_mc back to frame one. A simple gotoAndStop() doesn't work. Using a parent to issue the order to the movieclip doesn't work either. -How can I make menu_mc go back to frame 1 when clicked on inside itself note: I am also open to the suggestion that I'm just going the wrong way about this. I'm really learning as I go here.
controlling the browser scrollbar with as3   (273 Views)
, I have a simple gallery that rearranges itself when the stage is re sized. Can anyone help me with adding a scrollbar to the browser once the stage size is small enough. I want to add a scrollbar to the browser window when the stage height is reduced below a level.
controlling movieclip from hierarchically equal movieclip   (154 Views)
, first flash website. I'm a designer, wanting to make a portfolio website. So i have 4 movieclips on stage, with - when you click on it - a dynamic drop down menu, each placed within these respective movieclips. This works fine. Now I should add next functionality: when the movieclip1 is clicked (and the menu drops down), the other 3 should be with menu dropped in (so one of these three will have a menu dropping back in, while movieclip1 menu is dropping down.) So i guess i could put my question this way: 1) how can i control from within movieclip1 actions in hierarchically equal movieclip2, 3 , 4, ... 2) how to do it efficiently in code I tried already a lot of stuff, please check the fla file in attachment. It's only this step away from a website... http://www.sendspace.com/file/2hluz9
XML text: controlling the MC   (155 Views)
Hi! I am loading text from an XML file into dynamically created MCs. How do I target those MCs so that I can change where they are, their alpha, etc. For example, I want them to have zero alpha until the image from the XML node they're in is loaded, then make them visible. XML: PHP Code: portfolio/01.jpg one AS: PHP Code: functionxmlLoaded(e:Event):void{ varloadedxml:XML=newXML(e.target.data); for(vari:uint=0;i
Parent SWF controlling Child SWF variables   (187 Views)
1) The code below works but the browser sends an annoying alert message Received Parent Message and you are obliged to click OK before the program can run. How can it be fixed 2) Why this code needs to use the ExternalInterface class if the Child SWF gets loaded and becomes incorporated in the Parent SWF 3) Is there a simpler and more straightforward way for a Parent SWF to communicate with a Child SWF package { import flash.external.ExternalInterface; import flash.display.Sprite; import flash.text.*; public class ChildMovie extends Sprite { public function ChildMovie():void { // } public function alert(msg:String):void { ExternalInterface.call('alert', msg); txt.text = msg; } } } package { import flash.display.Loader; import flash.net.URLRequest; import flash.events.Event; import flash.display.LoaderInfo; import flash.display.Sprite; public class ParentMovie extends Sprite { public function ParentMovie():void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, onLoadComplete); loader.load(new URLRequest('ChildMovie.swf')); } private function onLoadComplete(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; addChild(e.target.content); var swf:Object = loaderInfo.content; swf.x = 75; swf.y = 50; swf.alert('Received Parent Message'); } } }
bulleted links: controlling margins / splitting   (166 Views)
I have been working on an animation with Actionscript 3.0 (see link below) that utilizes an xml file to dynamically populate a text field with links. I am then putting them into some sort of bulleted list. I am having a problem fine-tuning the formatting of links whether they be in a ul list or some approximated styling. I first put bullet styling in as3. But I could not control the margin spacing between the bullets and the links so it was too big for my the small space for the rounded rectangles. I then tried to put it in an ul html list, same thing, couldn't control that margin space. I don't think Flash/Actionscript allows for this type of formatting. Is this true Then I tried to add a break and a space in the xml. For some reason, flash breaks it into 2 links, even though I put the break and the space within the link. I even tried to put in a placeholder symbol in the xml and then replace it after importing the xml into flash. When Flash parsed the html text. it again broke it into 2 links. I also tried to add the break and the space in the Actionscript, same thing 2 links. (See the first bullet point in the yellow popup). The text needs to indent and not wrap under, any suggestions
controlling main swf through sub swf   (163 Views)
i have main fla its name "sections.swf" it loads sub swf files "sec1.swf" that has animation that open window movie clip with instance name "cont" and a close btn inside "cont" with instance name "close" i want to play a specific frame on "mainSection.swf" when i click the "close" button my code: Code: close_btn.addEventListener(MouseEvent.CLICK, closeBox, false, 0, true); function closeBox(evt:MouseEvent):void { // This tell the window to play its timeline cont.play(); // This tell the "mainSection.swf" play its timeline, lets say label "sec1" MovieClip(parent).play("sec1"); }
controlling an embedded movie   (144 Views)
I have embedded a move clip into flash. I want to control it, loop and and move to frame. I tried myMovie.stop() and myMovie.gotoAndPlay(20); 1061: Call to a possibly undefined method stop through a reference with static type flash.media:Video.
javascript controlling actionscript   (77 Views)
Mod, delete this message. Forgot to clear my browser cache.