Flash - Accessing A MovieClip's Property Within A Sprite (and Vice-versa)?
Jan 11, 2011
test.fla's document class is Test.as
test.fla's library has two MovieClips ThingMovieClip and Thing2MovieClip
I tried accessing the Thing.as public var thingState's property;
directly,
using something called Casting (??),
assigning an instance name,
but something that seemed so simple doesn't work,I commented the errors I got next to each way I tried,conversely how would I access the MovieClip Thing2MovieClip from Thing.as (which is a child of Test.as because that's where it's instantiated), it just doesn't recognise an object of its parent exists, here are the 2 classes:
package com.hello.test.test
{
import flash.display.Sprite;
import flash.events.Event;[code]........
I think i'm missing some basic but fundemental understanding of ActionScript 3 and I have no other knowledge of other scripting /programming languages either.when I follow tutorials exactly they seem simple enough, but then start applying what I think is logical usage then it throws up errors..
View 2 Replies
Similar Posts:
May 18, 2010
Load variables from flash into php and vice versa? possible? how?
View 3 Replies
Mar 26, 2010
Is there a library simplifying the process of dragging and dropping between the Flash/Flex environment and the surrounding browser?
I've done some research on the process, and so far the closest thing that I have found is from HTML to Flash in a Floorplanning application. I have yet to find a demo going in the other direction however.
View 1 Replies
Oct 4, 2009
I am trying to build a small script where I can convert celsius to farenheit and vice versa, I am able to convert celsius to farenheit in a file but not getting how to do the farenheit to celsius convertation in same file. I am giving the script i am using below
enter_button_mc.onRelease = function() {
var f:Number;
var c:Number;
f=1.8*c + 32.0;
[code]...
View 0 Replies
Feb 12, 2010
This link will show you what I'm trying to do, but in AS3 and with additional features I've described below[url]...
Need to be able to modify the text in the dynamic box, which also manipulates the slider. For instance, I'd like to be able to drag the slider to, say, 12 and then type in 25 on the box and the slider moves to 25. Control Flash slider bar with input text and vice versa in it?
View 1 Replies
Oct 30, 2009
I have some avi files that I need to turn into swf. When I convert them to flv files using adobe media converter on the PC then put them into flash and export as swf files, they look good on the pc but will not show on the mac (just white box). Conversley when I make swf files on the Mac (using the FLV files from the PC) they look OK on the mac but do not work on the PC?
View 1 Replies
Jun 28, 2010
Here's a bit of code I wrote to convert hex to RGB and vice versa.
ActionScript Code:
//array function from Roland Levy
Array.prototype.getPos = function(item){
for(i=0; i<this.length; ++i) {
[Code].....
View 7 Replies
Aug 18, 2010
I am interested in understanding how to run a Flex-3 SWF inside a Flex-4 SWF.My Flex-4 host app looks like this:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[code].....
View 2 Replies
Feb 20, 2011
I have a functionality working with a file hardcoded through URL Loader, but I want to be able to select the file from anywhere on my harddrive in an Air application.
public function loadFile(): Array {
csv = new URLLoader();
csv.addEventListener(Event.COMPLETE, completeHandler);
[code]....
View 1 Replies
Jun 15, 2011
I have started working with colors and have got a need for playing with hexadecimals. I tried making a variable which adds two hexadecimals, and it works but when I trace the answer, it comes out in decimals. How can I make it remain in hexadecimal or convert the decimal to hexadecimal?
View 6 Replies
Jun 15, 2009
But when I go in front of the shelf I want it to swap layers and vice versa on the other side so it looks 3D my problem is that the sensors on the other side get touched when going in front! Then it swaps layers for the other side...
View 1 Replies
Feb 11, 2011
Using a standard Flex DataGrid, is there an easy way to determine the grid row index given the data object or index of the data object in the data provider? On the flip side, is there a way to get the index of an object in the data provider based on the DataGrid row index?
View 1 Replies
Jun 21, 2011
I am trying to use the _visible property of loaded swf files to trigger the opening animations of these files to prevent the animations from playing before the preceding swf animation finishes. The problem is that the property of the loaded swf files read true when false and vice versa. If you click the link again, the property reads correctly (false when false etc). The onEnterFrame handler seems to be the issue, but I need it to read the property. The code is a bit lengthy, but I posted it for reference sake.
// the purpose is to unload the content and use the width property
// or visible property to trigger the opening animation
// of the next swf file
onSelfEvent (load) {
[Code]....
View 4 Replies
Dec 5, 2011
Flash AS2, AS3, and so on have many limitations. For example it is almost impossible to do transitions from a straight path to a curved one and vice versa for example as required in a in a car race game. You may have go for a frame by frame animation which is very cumbersome.
View 1 Replies
Jan 12, 2010
I wonder if it is possible to pass values from external .swf files to the main projector (.exe) file.? I would also like to know how a button of an external swf file can control the playhead of the main .exe file.
I have this map of tasks. and each map have these houses which when clicked will take you to a certain task(external swf). and when accomplished should have a button to take you back to the map(main swf), and also the button to send a value to the main swf that the task is accomplished.
View 2 Replies
Mar 31, 2011
I am trying to create an animation that will show the basics of steering a sailboat. The idea is that there will be a top view of the boat with the tiller and rudder very pronounced. I want the learner to be able to click and drag the tiller one direction or the other, while the tiller is dragging I want the rudder and the boat to rotate the proper direction. Example, I want the boat to go left I will push the tiller to starboard and the rudder will rotate clockwise and the boat will turn left. There doesn't need to be forward motion by the boat in my head, I think that as long as the boat rotates it would be fine.
View 2 Replies
Jul 4, 2009
i have a loader.swf contains important functions and variables that loads 10 external swf-s (site compontents) in a container MC, those external swf-s also have some important functions and variables.my problem is that i don't know how to access the variables and functions declared in the main swf ( loader.swf ) from the loaded swf-s.so the hierarchy looks like:
Code: Select all
main swf ( loader.swf )
childAt(0) ( container MC )[code].........
1. ( for example ) : how can I access/refer the functions and variables declared in the "main swf" ( loader.swf ) from the "2. loaded swf" ?
2. how can i access/refer the functions and variables declared in the "2. loaded swf" from the "1. loaded swf" ?
View 14 Replies
Apr 20, 2011
I need to create an Array of movieclips so that I'm able to read / modify / add its properties. I thought the best solution was to create an Array of strings with each movieclip's name and then using this to convert the string to an expression, but I don't really know what to do when I want to access one of its properties. Here's my code:
ActionScript Code:
var room:Object = new Object
room.objects = ["mcObj1", "mcObj2", "mcObj3"]
mcObj1.Description = "It's a ball and it bounces"
[Code]....
View 3 Replies
Sep 23, 2010
I am having problems while creating object with actionscript, I am new to it and I am getting some errors. I am creating my object this way
Code:
var myMC:MovieClip = new MovieClip();
myMC.x = 50;
myMC.y = 50;
myMC.name = "hunterToken";
tCursos.addChild(myMC);
And it is created, so far everything's good
Later I try to access the visible property, and I get an error
Code:
tCursos.hunterToken.visible=false;
And I get this error:
Code:
TypeError: Error #1010: A term is undefined and has no properties.
at newSiteHTR_fla::mCursos1_1/go()[newSiteHTR_fla.mCursos1_1::frame1:157]
View 3 Replies
Sep 25, 2010
generally, how i work involves designing all of my graphics in Flash Authoring, converting them to Sprite symbols by changing the base class to flash.display.Sprite, give my instances names and finally export them to ActionScript.the approach actually permits me to dynamically create properties in code on my Sprite instances that i've exported to ActionScript, just as if they were instances of MovieClips. i'm not entirely sure why i'm able to do this, but i can. in polling the objects to make sure of their superclass, they are indeed Sprites and not MovieClips.however, as expected, if i program a new sprite from scratch in code and try to dynamically add a property to the new programmed sprite a compile time error will result.
package
{
import flash.display.Sprite;
[code].....
View 2 Replies
Mar 25, 2010
My site is set up with next and prev buttons on the right and left sides respectively, and as you roll over either of the hit areas around the buttons a Sprite fades in which contains a TextField that describes the next page. Said Sprite calls the StartDrag() method, so it follows the mouse within the bounds, which is all fine and dandy on the left side of the page. Adobe, however, seems to have forgotten to put a way to dynamically alter the registration point of a Sprite, MC, whatever else, so when you roll over the right side of the page, the sprite is displayed from the top left and is mostly off the stage.
Trying to hack this problem I have tried numerous things ( classes written by others, other hacks) and the best that I have found is to use the scaleX method on the Sprite, changing the scale to -1. This, of course, makes the Sprite seem like it's reflected from its normal point, which means all its children show up backwards.
Is there anyway I can use this hack without it altering the text?
OR
Does anyone know a different way to go about displaying a Sprite from another corner? Any way to make a Sprite fade in and follow the mouse on the LEFT HAND side of the mouse pointer?
Here is a snippet to give an idea of what's happening:
naxtPage.labelBG.scaleX = -1;
nextPage.labelBG.startDrag( true, nextHitRect );
nextPage.labelBG.x = nextPage.labelBG.parent.mouseX;
nextPage.labelBG.y = nextPage.labelBG.parent.mouseY;
View 1 Replies
Jul 15, 2011
I am learner of AS3 and xml. So I have referred everywhere and copied the code. I am getting:
"Error #1069: Property data not found on flash.display.Sprite and there is no default value.
at flashhaupt01_fla::GalleryData01_1/imagepress()" error in as3.
I am trying to get the url from xml into as3, but not getting how to do it. Here is my code
var xmlReq:URLRequest = new URLRequest("XML/ImagesData01.xml"); // rename to your file!!!
var xmlLoader:URLLoader = new URLLoader();
//xmlLoader.addEventListener(Event.COMPLETE, xmlLoader); // event listener b4 load!!!
xmlLoader.load(xmlReq);
var myXML:XML;
var headLoader:Loader;
function imagepress(e:MouseEvent):void {
[Code] .....
View 9 Replies
May 2, 2010
I'm attempting to read a property on a series of Sprites. This property may or may not be present on these objects, and may not even be declared, worse than being null.
[Code]...
View 3 Replies
Apr 10, 2011
I try access to (MySWF(movieClip)).id but I get a weird message error:
1120: Access of undefined property aslider
Which is defined in MySWF.init. If I remove (MySWF(movieClip)).id program works perfect! Isn't this weird especially as I have added
addEventListener(Event.ADDED_TO_STAGE, init);
in MySWF constructor to ensure that aslider is on the stage.
In main:
private var idMySWF:int;
public function loadMySWF(event:MouseEvent) {
idMySWF = 1;
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
[Code] .....
View 3 Replies
Jul 15, 2011
"Error #1069: Property data not found on flash.display.Sprite and there is no default value.at flashhaupt01_fla::GalleryData01_1/imagepress()" error in as3.I am trying to get the url from xml into as3, but not getting how to do itI need to demo this within 1 hourhere is my code
var xmlReq:URLRequest = new URLRequest("XML/ImagesData01.xml"); // rename to your file!!!
var xmlLoader:URLLoader = new URLLoader();
//xmlLoader.addEventListener(Event.COMPLETE, xmlLoader); // event listener b4 load!!!
[code].....
View 6 Replies
Sep 4, 2009
I am trying to build a flip clock that utilizes filmstrip pngs. I have the main class instantiaing instances of the flipper class to hold the different number postions of the clock and then I want to tell the flipper instances to animate when the timer reaches a certain point in the main class. The problem is when I tell the flipper class to start animating I get a null value error from the flipper class.[code]Ok I guess writing it our helps figured out that the flipper wasn't through loading when I tried to call its properties, duh. Now can someone refresh my memory on how to broadcast an event to the Main class when the flipper class is done animating? I know I have to set bubbling to something but can't remeber exactly what it is. Also its not letting me create a singleton instance of the Main class in the Flipper class, I've done this before in other projects can someone tell me what I am missing on this one?
View 0 Replies
Jul 31, 2009
Is there an easy way in AS3 to strike-through a Sprite object. Since I want to do this on an array of squares, I was wondering if its possible to do this by simply setting a property. This would be much easier than drawing multiple lines.
View 2 Replies
Jun 29, 2010
Where does the .x and .y property of a movieclip in actionscript 3.0 measured from? from the centre of the object? or..
[Code]...
View 2 Replies
Oct 5, 2009
Through getChildByName is it possible to access the mouseChildren property of a Sprite? I'm guessing no, but before I go about changing something I want to make sure it's necessary and that I'm not just doing something wrong..
ex:
Code:
STAGE.getChildByName('container').mouseChildren = false;
Would give me an error. I see this is because getChildByName returns a DisplayObject object. So I guess my question is: Is it possible to get the actual Object (Sprite in my case)?
View 2 Replies
Sep 7, 2011
I need to use softkeyboard for a flash program developed for windows desktop, and I tried the example given on the following page: [URL] When I test the movie, it gives me a compiler error: 1119: Access of possibly undefined property needsSoftKeyboard through a reference with static type flash.display:Sprite. I noticed that this feature is available to flash players 10.2 or higher, so I updated my CS4, but it still didn't work. Does anybody know what is causing the problem?
View 3 Replies