Actionscript 3 :: Accessing A Subelement In Flash?
Mar 14, 2011
In Flash CS5 I have a button with an instance name "btn", which is made up of movie clips with instance names "mv1" and "mv2".
The question is: can I use gotoAndStop or something similar on the movie clips inside the button from the stage in which the button is instantiated. In pseudocode:
I've been trying to access my webcam on my macbook pro using flash cs4 in an attempt to try and use the live feed to detect levels of motion and from there use that information to alter / animate an image on the screen (idea being more movement = more change in image), however I cant seem to get my webcam to even stream out and play on a flash file.
The code I am using is: start code var camera; var video; camera = Camera.getCamera(); video = new Video(camera.width * 2, camera.height * 20); video.attachCamera(camera); addChild(video); end code
And when I run the file it asks for me to grant access to webcam / microphones (which is what it should do) but it doesnt stream to the file.
I have a flash that loads variables from a mysql database. It loads them with their id appending the variable. Example: Variable Name:itemName Id:1 var sent to flash:&itemName1=(item name in database)
Now the problem is in flash loading that variable with the added id at the end Code: onClipEvent(data){ t = this.totalItems; for(i = 1;i <= t;i++){ itemNames = this.itemName + i; _root.itemList.addItemAt(i, itemNames); }}
But the list returns NaN. I so far have 2 items in my database so these are the values returned. itemName1 description1 price1 itemName2 description2 price2 So I thought this.itemName + i would return the value itemName1 where i=1 in the for loop. Is there any other way to do this?
I've been trying to change the text within a SimpleButton instance using this:
var drawButton:SimpleButton = main.drawButton; var upButton:DisplayObjectContainer = drawButton.upState as DisplayObjectContainer; var upButtonText:TextField = upButton.getChildAt(1) as TextField;
I'm used to working with AS3, but due to recent events I need to work with AS2, and I'm having trouble with a simple task: How do I access a MovieClip in AS? I drew something, converted it to a symbol (of type MovieClip) and ticked "Export for ActionScript". I gave it the name "MyMC". now, when I'm in some other MovieClips action, how do I access the MovieClip I drew on stage before?
I have several symbols in the library (using Flash CS5), and all of these instances have a custom base class set with a method (lets say x()). I have the symbols already positioned on the stage using the IDE, and I wanted to access them through as3 and run the method. I understand that you can instantiate a new object of an item in the library, but how would I access the object that are on the stage already?
var objectList:Array = new Array(); objectList.push(InstanceName1); objectList.push(InstanceName2); objectList.push(InstanceName3); objectList[0].x(); //trying to run the method on the existing Symbol
However, flash returns an error saying that the object does not have method x(). Also looking through the debugger, it doesn't seem like the item pushed is an instance of the base class, rather it says (prototype). This works of course if I were to create a new instance of each, but I would rather access the ones that are on the stage already.
We have a website with a lot of Flash content on, and it would be unrealistic to modify all of that content. The problem we have is that Javascript can access variables in the Flash content that we actually don't want the user to have access to using[code]...
I want to write a Flash application which need to access my browser(Internet Explorer)cookie. My program work well in all browser except Internet Explorer. This is part of my code:
Quote:
function test() { ExternalInterface.call("eval","alert(document.cook ie)"); }
Okay, here is the relevant files for a game I am making and their structure: -Stage -->MainMenu.as --> NewGame.as --> beachArea -->barrel.as.................................................. ......-->player.as.................................................. ......--> pistolBullet.asSo, am trying to detect when a bullet hits a barrel. I was going to use the hitTestObject() functionI got as far as trying to actually access the properties of an instance of barrel from the pistolBullet.as and seem to be a little confused as to my findings.. Can anyone explain to me why the last trace function returns undefined?pistolBullet.as:
I am trying to develop an app for iphone using Flash Professional Cs5 and Actioscript. So what i need is i want to access Photos folder from iphone to my app. So may i know how this can be done ?? any links or code related to this.?? code or link or example.
I have flash (AIR) application running on a single controlled system (there is only one computer running it and nobody has access to it).I will host some files on Amazon's S3 and I need to make sure that only my flash app running locally on that computer can access those files.I'm wondering what the best (most secure) approach would be for doing this.My initial thought is to make the files on S3 private and store the secret key on the local computer running the flash app. Then when I needed to access the files from flash I would send out an authenticated query string with some expiration time. The only problem with this is that I don't know how to generate the S3 signature in flash. Also I'm a little skeptical about storing the secret key on the flash machine (even though it's a privately owned machine with no other users using it).Is there a better approach perhaps?I have access to a server with PHP, so I could maybe use that as some kind of proxy, I'm just not sure how while keeping the file access secure and not creating a bottleneck through the web server (as opposed to direct access to S3).
I use the following jQuery code to access functions in my SWF (FP 10.1 SWF embedded via SWFObject): $('#FlashApp')[0].someFunc(); This works fine in every browser.. except for Internet Explorer (surprise!). Surely, the point of jQuery is to make this code work across all browsers? I'd really rather not write extra code to check for IE. How can I talk to my SWF in a browser independent way?
I have a HTML page that contains a flash file and some a JavaScript function that returns the object of the flash file.So far I can call the JavaScript function from C# and have it return an Object, but I want to cast it as AxShockwaveFlash and access the COM Object directly from C#.I have seen this done with Windows Media Player imbedded in the a HTML page, but it doesn't seem to work with flash.[code]When I try to cast the Object to AxShockwaveFlash it fails, but I have seen it work casting the object to WindowsMediaPlayer.I tried to find if AxShockwaveFlash supports QueryInterface calls, as per the error message but Google returned nothing of value.
I am a beginner in Flash development and I was just recently assigned to fix an old Flash project at my work. Essentially, the application is a video booth whereby users can record up to 60s of video via their webcam and then share it either via email, twitter, or facebook. When the application is started, a video ID is generated, and that is used as the video's file name when it is streamed and saved to the server. I am sure there is a better way to do this, but the way I came up with is to grab that video ID and pass it to the "Share" page as a URL variable, and then use that to access and share the video from the server. How I can access the video ID from the button that is sending the user to the "Share" page.
Here is the code: var nc:NetConnection = new NetConnection(); var ns:NetStream; var cam:Camera; var mic:Microphone; var vidId:String = configName(); function tracer(p_s) { [Code] .....
I'm using FlashDevelop as IDE and I'm trying to connect to AMF3 service (amfphp) and get user details.I can connect to AMF service with this code in AMFinit() function...
private function AMFinit():void{ AMFService.objectEncoding = ObjectEncoding.AMF3; AMFService.connect(AMFServiceURL); AMFService.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
[code]....
But to use outside the AMF_MyUserInfo() function I want to copy that "res" object to another object. I tried with specifing an object in Class and set res to this object in AMF_MyuserInfo() function with "this.myobject = res" but it didn't work.
I also tried "this.myobject.username = res.username" but it didn't work also. how can I use this res object globally or in AMFinit() function?
i have embedded the simhei simplified Chinese font in a .swf for a font Library. I need to make a list of buttons, that are labeled with all the embedded fonts in the .swf. All the other languages were done in CS4 so there is font registering and everything and the .as for it. I am pretty new to flash, and i am working in CS5 but i don't know how to get a hold of the font i already embedded to turn it into a font button.
i have never actually got the flash-actionscript code execution order.in flash pro i have an instance of a moveiclip on stage in frame one named tree1 and on frame 3 i have on the stage tree3.in the document class i have this code:
stop(); var scaleFactor:Number = tree1.scaleX; gotoAndStop(3); tree3.scaleX = scaleFactor;
while this works when testing on the desktop, this app will go mobile at the end.is this the correct way to go or should i register for a frameComplete event before accessing instances on a certain frame
I am trying to access movieclips within my movieclip using a for statement. To try and make this clear, here is how it looks at the moment:
sections = Holder movieclip where dtf_sections is placed, as well as other clips that are needed.
dtf_sections = Where all the title movieclips are placed that are going to be used when called. Placed in here to make it easier to move, within sections
title = Movieclip that contains the text that needs to be changed, within dtf_sections
So I am writing a program which uses Dictionary to store objects. For example
var dictionary:Dictionary=new Dictionary(); var myObject = new myObject(var1, var2, var3); dicionary["key"]=myObject;
where var1, var2, and var3 are simply means of assigning values to variables in myObject.can I access values or functions that are found in myObject? In myObject class I have some getters and setters. Can I use a getter to get the value of var1 for example.
I need to set properties of buttons on the main stage from the current class. How would I do this?
I have multiple buttons on my stage. Each representing a chapter in a movie (from frame x to frame y of the movie).
When I push one of them, the movie plays. When it gets to the end, it should continue to the next segment/chapter. This works, but now I need to highlight the current button, not let the button I pressed be highlighted forever..
Using MovieClipLoader, is it possible for the loaded swfs to access movie clips in the container swf movie? In building a preloader for a previously produced flash app (originally made for CD), I was running across huge problems with some dynamically created masks (created using attachMovie and setMask). My solution (not ideal, I guess) was to move the masks and the masked objects into the preloader ("container") movie. But still need to move them around by code located inside the swf being loaded.
Relevant code from inside the preloader: myMCL.onLoadInit = function() { _root.attachMovie("screenText12", "screenText12", 15) _root.attachMovie("internalMask", "internalMask12", 17) _root.screenText12.setMask("internalMask12"); }
And from inside the swf being loaded: _root.screen12.onMotionFinished = function() { screenText12InY = new Tween(_root.screenText12, "_y",mx.transitions.easing.Regular.easeOut, 463, 403, .5, true); The red is where I'm not sure of how to get in contact with the movie clip in the preloader.
Okay so there are four variables on my timeline, two of which are arrays:
var greenSpriteArray:Array = new Array(); var pinkSpriteArray:Array = new Array(); var greenNum:int = 1; var pinkNum:int = 1;
whenever I refer to them from a class file by just the variable names I get a 1120 undefined variable error. But if I call for example stage.pinkNum I get "1119: Access of possibly undefined property stage.pinkNum through a reference with static type flash.display:Stage."