Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Quick Queston About Classes



if I want to refer to a movieclip on the timeline, how do I access it inside a function without using _root ?


Code:
class MyClass{
public var my_MC:MovieClip;
public function MyClass(){
//simpleTrace(this.my_MC._width); //Trace undefined
//simpleTrace(my_MC._width); //Trace undefined
simpleTrace(_root.my_MC._width); // Trace the width
}
private function simpleTrace(i:Number){
trace(i);
}
}
I don't want to use _root, because I want use my class with swf nested inside swf



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-05-2007, 05:39 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Quick Question About Classes
I have an image gallery class that I'm bringing to the stage by clicking a button and when I click it it comes to the stage but without a transition. How do I add a transition tween to a class I'm bringing to the stage? Do I have to transform it into a movieclip? Thanks

Quick Help With Attaching Classes.
I seem to be doing something wrong. I only wan't to attach the classes after certain triggers during runtime.

Code:
newDepth = 20405;
import enemyPlane;
Object.registerClass(ePlane, enemyPlane);
_root.enemy7.attachMovie(ePlane, enemy7, 20548);
I'm trying to attach the class enemyPlane to the instance enemy7... Argh!


Omg... This sounds bad...

In Flash MX, Object.registerClass() is used to associate a symbol in the library to a class. This new method affects all instances of the associated symbol; unlike VMC, which affects per movieclip instance.

Damit... I guess what I'm trying to do won't work...

Classes - Quick Question
Hey
If I have one Main class that initiates a second class like this:

Code:
Main.as
package {
public class Main extends Sprite {
function Main() {
var a = new SecondClass
}
public function coolStuff() {
trace("A");
}
}
}

SecondClass.as
package {
public class SecondClass extends Sprite {
function SecondClass() {
//do the coolStuff function in the Main class
}
}
}
How do I get my SecondClass to call the coolStuff function in the Main class? I tried doing somthing like "Main.coolStuff()" or "parent.coolStuff()" but it does not inherit and I can not be bothered with inheritance because I do not want to script my stuff like that. For example, I want a textFormat class to be defined on the Main class but used in all classes in my code, how do I do this? Im sorry to ask such a noob question but Im new to OOP and scripting ideas like this.

Thanks for your help,
Dan

Quick Question About Classes
I have recently jumped into the world of custom class development. I have a quick question about what direction to take on this.

I have a custom class that basically will, onRollOver, cause a movie to fade in, and onRollOut, do the opposite. I have got that working correctly.

I have twenty five movie clips that need to function the same exact way. All of these mc's are housed in one container_mc. They have the instance name of "mcBlip".

How can I implement this class once and make everything instanced as "mcBlip" in the "container_mc" clip function?

Note: the movie structure is like this.

container_mc - holds twenty five clips named panel1, panel2, etc...

inside the panel1 mc's is a two layer mc the top layer mc is "mcBlip" that I want to fade in/out


Any help on pointing me in the right direction would be greatly appreciated.

Short And Quick Classes Question
Hi,

I'm wondering if there is a way of extending a class which is extending the movieClip class?
Or generally a way to add extra methods to an allready existing class without having to add them in the actuall class declaration.
I was thinking of using Interfaces but how can I implement an Interface to a class which is extending a movieclip?
as far as I know I have to write something like this:

Code:
import interfaceName
class className implements interfaceName{
//stuff
}
but where do I put the code which extends the MovieClip?


Code:
class className extends MovieClip{
//
}
Cheers,
Manorius

Quick Question Regarding Arrays Of Classes
Hi, I am a C++ programmer but have been asked to complete a small task in Actionscript over the weekend. I am currently having a little difficulty...

I have a classes named baddie that contains all the variables of a baddie spaceship the constructor of which looks like this:


Code:
public function baddie( inIDepth:Number, inX:Number, inY:Number )
{
//create default baddie...
iDepth = inIDepth;
var spriteManager:spriteManagement = new spriteManagement();
baddieShip = spriteManager.makeSprite("mBaddie1", iDepth);
baddieShip._x = inX;
baddieShip._y = inY;
}
All this does is load a bitmap into a movieclip file (assume any variables you see which aren't defined are members of the class) at the specified position.

I'm trying to display a grid of 5*4 of these 'baddies' on the screen and I'm doing it like so:


Code:
case 1 :
{
//Easy pattern, set up only normal baddies...

for( var i:Number = 0; i < MAXNUMBEROFBADDIES; i++ )
{
//Add normal (default) baddies to array only...
if( coloumCount < 5 )
{
curX+=30;
coloumCount++;
}
if( coloumCount >= 5 )
{
curY+=50;
curX = 50;
coloumCount = 0;
}
var currentBaddie:baddie = new baddie( iDepth+10, curX, curY );
baddies.push( currentBaddie );
}
break;
}
Basically in the above code I'm just trying to draw the baddies to the screen in a sort of grid format and at the same time add all the baddies on the screen to the array named baddies.

However, the only baddie that is drawn to the array is the last one in the array.

Any idea why this is?

J

Quick Question About Importing Classes
Ok, I'm trying to create a website that loads external swf files on an as needed basis. I want a root directory with subfolders of the different cateogries, i.e a games folder, animations folder, etc. Many of these flash programs use some of the same classes that I've made (a vector class for example). I could just include a copy of the class file in each folder, but that seems like a waste of space. I'd like to have a folder named classes in the root directory that holds all of them. I can access them fine from the root folder using the following:
I put the following import statement at the beginning of the file
import classes.vector;

With the vector.as file starting like this:
package classes{
public class vector{
//Rest of definition here

And it is located inside the classes folder

Is there any way to use a import statement similar to the one above from inside another directory? Is there a way to add other classes to a class if they are in a separate folder that is not a sub-directory?

Thanks,

Queston
Hi!

I'm currently trying to work out how I could make a game where the user can draw a line and a movieclip will follow that line. Kinda like a tween with a guide layer.

I've got the line drawing bit but i'm struggling to find a way to make a movieclip follow it. any ideas or helpful suggestions would be greatly appreciated.

Cheers

Hot Spot Queston
Hi,

First of all i am not sure if there is a possibility for this to work, but if it is I would like to know =)
I have a mc that I need to load into a certain place because its location is different between graphics. Maybe I should explain what its for. I am workin on a wheel preview demo, where you have differnt cars and see what different wheels look on them for a breif idea. What I would like to know is if I have the center of the tires where i want the wheels to go, how do i make it so the wheel swf loads into the tire holes(the "Hot Spot") because between teh different vehicles i have different distances apart between the two tires. Any help would be great. Thanks


-Matt

Math Queston
Please excuse my ignorance.

If I have 57321 - how do I round up to 60000?

This obviously works:
var value = 57321
Math.round((value/10000)) * 10000

But how do I dynamically create the divisor, 10000? i.e. so that a value of 5400 will round up to 6000?

Simples QUesToN
hi! i m doing a pop up portfolio, a main flash will lunch one popup window.
what code i use?
i try:

Quote:




on (release) {
getURL("javascript:window.open('home.asp','me','60 0,400,0,0,0,0,0);
}




didnt create

can i do ?

Simples QUesToN
hi! i m doing a pop up portfolio, a main flash will lunch one popup window.
what code i use?
i try:

Quote:




on (release) {
getURL("javascript:window.open('home.asp','me','60 0,400,0,0,0,0,0);
}




didnt create

can i do ?

HitTest Area Queston
with the movieClip.hitTest(); command,

It seems that the area you are testing it FROM works well with any shape.

But the area it tests is always a bounding box (that is, if you had a circle or star shape, it would treat it as a box square)

Is there a way round this so that the area it tests for is not always a bounding box?

Cheers,
fg

Super Noobie Queston
hello. im VERY new to flash and i normally figure stuff out by my self but i cant seem to fix my problem. this is a super noobie queston that i cant figure out. you know how u make a motion tween to make moving objs smooth? well how come when i make a stick man out of the line tool, i can only scale it and make it move around the screen. i cant make his arms move or anything. its like its a picture i imported or something. when i take away the tween, i can move his arms and legs fine. i know this is a stupid question and iv tryed to fix it my self but i cant seem to find out why and i cant find any tutorials on how to make stick ppl :P
anyway, thanks 4 ur help

TJET

_root.gotoAndPlay(); Queston
Hello !

I was trying to solve this problem on my own but just wasted a whole day , so i need your advice people

i have move.swf and in it i have a button play intro and in the button i have an action gotoAndPlay(50); on frame 50 i have a loadMovieNum('intro.swf',10); and as soon as intro is loaded it's playing when it's close to the end i have a action _root.gotoAndPlay (1) and i should go to movie main.swf and play frame no.1 but it doesn’t i am desperately need help -(

any ideas are welcome!

Functions Prameter Queston
I'm attempting to learn how to send and use parameters with a function but i'm having trouble wrapping my head around it when and why would i want to pass a parmeter and then use it...should i be using the parameter part of a function each time i write a function? Plz use the following code to write some examples and plz make sure it has some trace output or dynamic text output.


Code:
function IncreasesX(x) {

x = x + 1;

}

Math Random Queston
Does anyone know of a way to control math random so it generates a random number, but never duplicates it?
Thanks!

Slight Legal Queston
if i grab a gif of (for example) a sprit walking (like in a rpg game) and i make a game out of this and DO NOT charge to play, Do Not sell, or claim that i created it do i need to give props to who created the gif file?

Passing Var Into Flash Movie Queston
Hello,

I have the need to pass a number of different varaibles into a flash movie located on a differnt frame. I have the code to pass one variable, which is java script:

function set_broker(test) {
//alert(test);
document.side.SetVariable("broker_name", test);
}

***it workds fine,but I can only pass on variable in with the above code. how can I make it where I pass 5 variables???


Thanks,

Loader And Class Logic Queston
so Say I have a simple loader class that loads a jpg, and fades it in. I'm handling the url to the image with event.target.. so ust ignore that and just assume that's fine..

ActionScript Code:
var loadFade:LoadFade = new LoadFade(jpg url);
addChildAt(loadFade, 0);
so that puts it on the stage.. and it fades in and all is wonderful.. but then I want another instance of it to fade in on top of it. so since this is in the bg.. I made a variable to tell me if one has been loaded in already..

var numberLoads:int = 0;



so that made it..

ActionScript Code:
if(numberLoads>=1){
var loadFade:LoadFade = new LoadFade(jpg url);
addChildAt(loadFade, 1);
}else{
var loadFade:LoadFade = new LoadFade(jpg url);
addChildAt(loadFade, 0);
}
numberLoads+=1;

my question is.. I want to unload the first instance (bottom one) after the new one fades in.. and I have an unload method in my class.. so I can.. but what is the best way to do this.. if I know the fade takes 3 seconds.. should I just set a new timer for 3 seconds and unload it after that? again, I'm a noob, and any guidance is greatly appreciated.. thanks

EDIT
please put code in
[ as ] [ /as ] tags (without spaces)

Quick Question About "Export Frame For Classes" Publish Setting...
I finally decided to switch over to the MovieClipLoader() class when building preloaders and a question I never really thought about finally came to me: do built-in classes apply to the "Export frame for classes" publish settings?

I always knew this setting affected how components behaved, but I never thought about built-in classes. Yeah, probably a dumb question, but I'm still curious.

Iframe Queston - Showup All Flash Contents
hi there,

I am using iframe at the moment, now I would like to show the popup contents fully. it only shows a "little" on my screen.

it is better to showup in parent window(iframe)...but it's only showup in flash.html file

please refer the sample here => http://bbs.anjia.com/viewFile.asp?Bo...4&ID=26229

Cheers

Null Button/mc & Preloader Queston (newbie-style)
Okay, here's my site www.rberry883.home.comcast.net that I'm working on (slowly) and made all my buttons (across the top) as movie clips. They all work fine but I want to know how I can disable the one for the page you are on. For example, if I hit the one for Gallery, you go to the gallery page but you can still click the gallery button and it reloads the page.

Also, under PC Stuff, I have a thumbnail gallery that I should have a preloader on for the thumbnails and for the component itself but I don't know where it would/should go (on main timeline, in external .swf, etc). I read some of the preloader tutorials but they seem to be more for loading an entire site which I don't want.

Any help is appreciated or just help me out with some links.

Custom Classes: One Class Tracks Multiple Other Classes?
I'm working on a coloring that allows kids to place objects on a scene and then color them so the image can be printed out. So assume you have sky background, the child can select a bird object, drag it into place and once they have it in place, color everything on the page (with a given palette of colors.)

So far it going great. However I want to track what objects have been added to the drawing on the fly. I have a potential solution using arrays but I'm thinking this is perfect opportunity to start using custom classes.

I'm thinking that I'd create a new instantiate a copy of the object class each time an object is added to the scene. However to track the objects added to the scene I'm thinking I'll also use an listing class to track them.

What I'm not sure about is the would the listing class simply contain an array of object identifiers? Any thoughts on the structure of the listing class?

I'm very new to oop as I've mainly been doing procedural programming up to this point but I'm eager to give this a shot.

Thanks!

Using Flex Classes In Classes Linked To Symbols
Hi all

I have a fla file where I link a symbol to an action script class. This action script classes references mx.collections.ArrayCollection; so when I attempt to publish the fla file, I get the error message:
1017: The definition of base class ArrayCollection was not found.

I then tried to add a class path (this folder contains the mx... classes):
C:Program FilesAdobeFlex Builder 3sdks3.0.0frameworksprojectsframeworksrc

and the the above error 1017 wasresolved, but now I get the error:

Version.as, line 18 1004: Namespace was not found or is not a compile-time constant.

So now I am pretty much stuck. What do I need to do for this to work ? Please note that the code compiles fine in flex, so it is not som basic coding error ?

Instantiating Classes Inside Classes
I have a class called spaceship in which i have instanciated another class weapon. However, when i call on a method of weapon (which at this point is just simply trying to trace "hello"), it doenst work and the object basically doenst exist. It's delcared in the class as:

Code:
private var ShipWeapon:weapon;
Note that when I instantiate a weapon class on the main timeline the thing works and "hello" is printed to the output panel. However, nothing at all happens when instantiated the weapon class inside my spaceship class. Both traces come up "undefined". Do i need to declare the class as some sore of special class or somethings? Thanks in advance

[classes] Best Method To Communicate Between Classes
Here's the scenerio:

I have a component that is associated with a class. Inside the component is an empty movieclip.

-component (part of a class)
&nbsp;&nbsp;-mc

The main component's class upon init will load a movie from a remote server into the mc movieclip. System.security.allowDomain is in there...

Now, inside the swf that gets loaded into the mc is an empty movieclip that's associated with it's own class:

-component (part of a class)
&nbsp;&nbsp;-mc (contains loaded movie)
&nbsp;&nbsp;&nbsp;&nbsp;-mc (part of a separate class)


Now here's the challenge... I need to have the loaded movie > mc's class be able to communicate with the main component's class.

What's the best setup to be able to communicate between the two classes directly? That is, if I don't have loaded movie > mc > class inherit from the component's class.

thanks in advance...

Nathan

Best Flash Classes (Taught Classes)
I think this site is great for newbies in the flash world to Advanced flash developers. I am an intermediate flash designer/developer and I have been using flash since 1998. My strengths are more on the design side for sure. I am just curious what your experience is with going to a week long flash class. I have been to several classes and my last one was a week long one with Joshua Davis on advanced actionscript in NYC a while back. This was still coding in AS1 with dot syntax so only some of it is relevant to what we are doing today. I am wondering what are the best classes out there today and what your experiences are if you have been to any. I wish another event like this: grant skinners FITC flash 8 workshop or this Colin Moocks actionscript bootcamp were available but I can't find anything like it. My friend went to Colin's workshop a while back and mentioned how he went into design patterns with AS2 and it would be great to learn about that. ANyhow any suggestions would be great. Post your thoughts.

Instantiating Classes Inside Classes
I have a class called spaceship in which i have instanciated another class weapon. However, when i call on a method of weapon (which at this point is just simply trying to trace "hello"), it doenst work. The compiler obviously didn't flag anything, but i also get "undefined" for all my weapon class varibles. Do i need to declare the class as some sore of special class or somethings? Thanks in advance

Quick Question - Need Quick Answer - Load Movie
If I load an swf movie into one mc named "mc1". and then I want to load the same swf movie into another mc "mc2", will the swf need to load again into mc2 or will it already be catched.

I am assuming yes ...

Thanks,
DRB
[Edited by funner on 06-14-2001 at 09:53 PM]

Best Way To Script A Quick-slow-quick Movement ?
Hi

I'd like to make a clip move across the stage like this :

- first it moves fast and then decelerates to a slow crawl for a short while then re-accelerates and moves fast to the end of its movement

what's the best way to do this ?

is it better to use mx transitions or intervals or another system ?

thanks

Accessing Classes From Classes
ok something I don't get. In as2 I used to have a main class, which I created an instance of my Useful.as Class in. And then when I created say a monster instance from my monster class, I used to pass it a reference to the main class, so I could access the Useful instance from a function in my monster class like this


Code:
main.Useful.RandomNumber(1,100);


But this doesn't seem to work in as3

It just gives me a reference error, even though when you look with debug mode the Useful instance is sitting there in the main class, and there is also a reference inside my monster instance to the main class. I found that if a pass a direct reference to the Useful instance to the monsters constructor, and setup a var called Useful inside my monster instance then I can just do this


Code:
Useful.RandomNumber(1,100);


but why doesn't the old AS2 way of things work?

Accessing Classes From Other Classes
Two Classes: Tile, Map

I know Tile works and is accessible from the main timeline because I can create and object and trace properties, so the timeline is able to import it.

When placing the same import statement in the Map class I get: 1046: Type was not found or was not a compile-time constant: Tile.

Here is code


ActionScript Code:
package layout
{
    public class Tile
    {
        public var filename:String;
        public var myX:int;
        public var myY:int;
        public var ext:String;
        public function Tile(sFilename:String)
        {
            filename = sFilename;
            var nPos1 = sFilename.indexOf('_');
            var nPos2 = sFilename.indexOf('.');
            myX = Number(sFilename.substring(0, nPos1));
            myY = Number(sFilename.substring(nPos1+1, nPos2));
            ext = sFilename.substring(nPos2, sFilename.length);
        }
    }
}




ActionScript Code:
package layout
{
    import flash.display.*;
    import flash.net.URLRequest;
    import flash.events.Event;
    import layout.Tile;
    public class Map extends Sprite
    {
        // tiles[y][x]
        public var tiles:Array = new Array();
        public function Map()
        {
            if (map == false)
            {
                var map:Sprite = new Sprite();
                this.addChild(map);
            }
        }
        public function AddTile(sFilename:String)
        {
            var Tile:Tile = new Tile(sFilename); //This line causes issue
            tiles[Tile.myY] = new Array();
            tiles[Tile.myY][Tile.myX] = new Array(Tile, false);
        }
    }
}

Using Classes Inside Of Classes
I have created a custom sound class called MySoundClass that extends the Sound class... it is declared as class com.stickyMatters.WineGlassPiano.MySoundClass. I also have another class called SongPlayer that is declared as com.stickyMatters.WineGlassPaino.SongPlayer... my question is.. how do i use the MySoundClass inside of the SongPlayer class... when I try to import it says I cannot use the import statement inside of a class file. I know in AS3 you can use the package keyword to create packages and do that... but as far as I can see there is no package keyword in AS2... because I tried, and it just tells me htere is a syntax error on the line with the package declaration... can you use one custom class inside another? and if so... how?

P.S. just to be sure... i am using flash CS3 and writing AS2 files. Thanks!

Classes In Mx 2004 (new To Classes)
hi everyone, Im Nubis, from Argentina.
I´m new to woking whit classes, Im using flash mx 2004 pro.

Ive created a class, that works correctly, it creates a square, a textbox, and uses a variable to pupulate the textbox.
(im sorry for my english)

in my library i have a MC (an empty MC) that is linked to that class.

I use this script to place the clip on the stage
attachMovie("card", "card", 1)
iknow the class works fine, but, I dont know where to pass the parameters to the class.

And if I use : Card = new MyCard("this Card´s Name or label ")
both the clip and the textbox are not created.

could anybody please help me?

thanks in advance :)
(feel free to make comments about my code)

this is my class code:
// MyCard
class MyCard extends MovieClip {
var thisCardName:String;
//method for creating the square
function gen_sqr (){
this.createEmptyMovieClip("Square",2);
with(this["Square"]){
beginFill (0x0099FF, 100);
lineStyle (1, 0x003399, 100);
moveTo (0, 0);
lineTo (100, 0);
lineTo (100, 70);
lineTo (0, 70);
lineTo (0, 0);
endFill();
}
}
//method for generating the textfield
function gen_txt(my_text){
this.createTextField("mytext",3,0,0,50,20);
with(this["mytext"]){
text = my_text;
multiline = true;
html = true;
}
}
//constructor
function MyCard (thisName:String){
//set the name or label for the card
thisCardName = thisName;
//
gen_sqr()
gen_txt(thisName)
//
trace("newclass Created")
trace(thisCardName)
}
}

Importing Classes In To AS3 Classes?
I am not sure how to import multiple classes into an AS3 class. Also I am bit confused on how "package" works now.

This is currently what I have and its wrong:


Code:
package {
import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;

class LoadImage {

public function LoadImage() {
var container:Sprite = new Sprite();
addChild(container);

var pictLdr:Loader = new Loader();

var pictURL:String = "catfishSMv.jpg"
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
function imgLoaded(e:Event):void {
container.addChild(pictLdr.content);
}
}
}
}
How should I actually do this?

Thanks

Classes In Mx 2004 (new To Classes)
hi everyone, Im Nubis, from Argentina.
I´m new to woking whit classes, Im using flash mx 2004 pro.

Ive created a class, that works correctly, it creates a square, a textbox, and uses a variable to pupulate the textbox.
(im sorry for my english)

in my library i have a MC (an empty MC) that is linked to that class.

I use this script to place the clip on the stage
attachMovie("card", "card", 1)
iknow the class works fine, but, I dont know where to pass the parameters to the class.

And if I use : Card = new MyCard("this Card´s Name or label ")
both the clip and the textbox are not created.

could anybody please help me?

thanks in advance :)
(feel free to make comments about my code)

this is my class code:
// MyCard
class MyCard extends MovieClip {
var thisCardName:String;
//method for creating the square
function gen_sqr (){
this.createEmptyMovieClip("Square",2);
with(this["Square"]){
beginFill (0x0099FF, 100);
lineStyle (1, 0x003399, 100);
moveTo (0, 0);
lineTo (100, 0);
lineTo (100, 70);
lineTo (0, 70);
lineTo (0, 0);
endFill();
}
}
//method for generating the textfield
function gen_txt(my_text){
this.createTextField("mytext",3,0,0,50,20);
with(this["mytext"]){
text = my_text;
multiline = true;
html = true;
}
}
//constructor
function MyCard (thisName:String){
//set the name or label for the card
thisCardName = thisName;
//
gen_sqr()
gen_txt(thisName)
//
trace("newclass Created")
trace(thisCardName)
}
}

Accessing Classes From Classes
Hi... I'm having some trouble with these bits of code... I got some help before from wangbar to sort it out when the var stored was in a class of its own. But trying to access it from another class isn't working...

class Ipa{
var c : Settings;
function Ipa() {
}
}

class Settings {
var currSubs:Boolean;
function Settings (s:Boolean) {
currSubs = s;
}
function getSubsOn ():Boolean {
return currSubs;
}
function setSubsOn (s:Boolean):Boolean {
currSubs = s;
return currSubs;
}
}

then at root level:
var dpp : Ipa = new Ipa();
dpp.c.setSubtitlesOn(false);

and level 3:
_global.subtitles = _level0.dpp.c.getSubtitlesOn();

if ( _global.subtitles == false){
_level3.speech._visible = false;
};


 And nothing happens...subtitles still showing...
Thanks in advance for help.
     silverswim


 


AS1 Classes And AS2 Intrinsic Classes
Anyone ever mess around with writing an AS1 style class (so that it can be used prior to your class export frame) and writing an intrinsic AS2 class to go along with it, to enable compile-time checking?

It's working well, at least for instance members. (The trick is you need to define your constructor like so:Code:

var MyAS1Class = function... and NOTCode:

function MyAS1Class...)

But for static members, I can't seem to get the compiler to recognize the AS1 static members as validating against the AS2 intrinsic classes static members. In other words:

Code:

import the.intrinsic.class.Foo
#include "the/actual/as1/class/Foo.as"

var myFoo:Foo = new Foo();

// This cause the compiler to complain:
myFoo.nonExistentProperty = "moo";

// This goes by undetected:
Foo.NON_EXISTENT_STATIC_PROP = "moo";

// This gets caught:
the.intrinsic.class.Foo.NON_EXISTENT_STATIC_PROP = "moo";
// But doesn't help because it's referencing the intrinsic class, which
// doesn't actually have any code and never gets compiled
(obviously the properties mentioned are not defined in this example intrinsic class)

It's apparently a problem of the actual AS1 class being a var on the timeline and the AS2 intrinsic class existing in a different namespace.

I've tried putting my AS1 class in the _global.the.intrinsic.class.Foo variable, like it would if it were a regular AS2 class.

I've tried Object.registerClass("_global.the.intrinsic.class.Foo", Foo), which I thought would work, but maybe I'm doing it wrong.

So far the best workaround is this:
Code:

Foo.__resolve = function(name:String):Void {
    trace("Oops, the member you've accessed, " + name + ", does not exist");
}Which at least provides run-time checking, but not compile-time checking, which is obviously why I'm doing this intrinsic thing at all.

I know this is a very esoteric question...any suggestions?

PS
Man, I do NOT miss writing AS1 OOP! I tend to forget how great AS2 OOP is when I use it exclusively. But coming back to AS1 OOP...<napoleonDynamite>Gawh!</napoleonDynamite>

Quick Quick....masking Problelm
Hi everyone
Um facing a problem regarding masking
well, i know how to mask texts with objects that I CREATE like a circle, for example the masked layer has text & the mask layer has a circle that I DRAW USING FLASH...this if fine...it works well
My problem is my masking does not work when i the mask layer has an object that is imported, for example an imported heart instead of a drawn circle....it does not work at all....!!!!
What's the problem?? & How could i solve it??
Any help is highly appreciated
thanks in advance

Quick Question = Quick Answer
I have a movie with an animation on one layer. Just a motion tween over 5 frames. In this movie I also want to target a blank clip and have another .swf load into that clip.

I'm putting the loadmovie script on a blank frame in my actions layer (frame 1) telling the .swf to load into the blank clip.

nothings happening? any fixes?

Project Opp - Quick $ Quick Job
I have a project that requires a rotating menu. It needs to be done today. If anyone is interested they should reply with their email address or send an email to eerkel @ hotmail .com.

I will then send a Fireworks file that shows clearly how the menu should operate.

Thanks

Using Custom Classes Inside Of Custom Classes
I have created a custom sound class called MySoundClass that extends the Sound class... it is declared as class com.stickyMatters.WineGlassPiano.MySoundClass. I also have another class called SongPlayer that is declared as com.stickyMatters.WineGlassPaino.SongPlayer... my question is.. how do i use the MySoundClass inside of the SongPlayer class... when I try to import it says I cannot use the import statement inside of a class file. I know in AS3 you can use the package keyword to create packages and do that... but as far as I can see there is no package keyword in AS2... because I tried, and it just tells me htere is a syntax error on the line with the package declaration... can you use one custom class inside another? and if so... how?

P.S. just to be sure... i am using flash CS3 and writing AS2 files. Thanks!

Using Custom Classes Inside Of Custom Classes
I have created a custom sound class called MySoundClass that extends the Sound class... it is declared as class com.stickyMatters.WineGlassPiano.MySoundClass. I also have another class called SongPlayer that is declared as com.stickyMatters.WineGlassPaino.SongPlayer... my question is.. how do i use the MySoundClass inside of the SongPlayer class... when I try to import it says I cannot use the import statement inside of a class file. I know in AS3 you can use the package keyword to create packages and do that... but as far as I can see there is no package keyword in AS2... because I tried, and it just tells me htere is a syntax error on the line with the package declaration... can you use one custom class inside another? and if so... how?

P.S. just to be sure... i am using flash CS3 and writing AS2 files. Thanks!

I Need Your Quick Assistance, Just A Quick "check, See, Tell"
Hello! Could you please go to this address

http://www.geocities.com/friendlyflashfun/clock.html

And tell me if my clock shows up?? I have FlashMX 7 Pro and it doesn't show up on my computer.

If it does or doesn't show up on yours could you please tell me how to correct this problem?

Thanks in advance,

Kelly

Classes
I'm having trouble finding info on how to setup classes in flash 5.

What i want to do is:

Create balls at a set interval.

These balls roll back and forth across a floor changing direction and color when they bounce off the walls.

So I'd like each ball to have a color variable and a direction variable.

How do i make a movieclip with these 'internal' variables, and how do i create them during play?

Using 3D Classes In MX
Hi,
I am hoping someone here is familiar with Brandon Williams 3D classes for creating cameras and vector objects in 3D in Flash MX.

I am trying to create a continous flyaround of a circular set of movieclips. This works fine if I rotate the movieclips using the rotation matrix, but to give me more interaction I wanted to create a camera that flew around the static movieclips. To do this I tell the camera to move sideways by a set amount and then look at a triplet point (the center of the circle of movieclips - and this is fine in the y direction, but then I wanted to add a more interesting movement upwards as well, so I tell the camera to move_upwards by a set amount and then look at the triplet. This works for 90 degrees of rotation at which point I can't tell exactly what it is doing but seems to have a problem deciding which direction to go and so just sits there.

If anyone can understand what I am going on about - help me!!
Robin

Classes?
How can i define a class like the Array class where you can assign values to a variatble directly and yet have it have functions attached to it.

I want to be able to do this.

myVar = 5;
myVar.testOutput();

//-----I want output to be
5

is this possible?
thanks

Classes && OOP In MX
Hello, everyone.

How would I go about associating a class with a movie clip? I mean, if I have an AS class, is it possible to be able to do the following:


Code:
MCnode1 = new Treenode();
And it create a new movieclip on the stage AND I be able to access members of the class Treenode in later AS code? Also, I'm unsure if the class should be defined on the _root and then I make the above calls, or if I should create the MC and then in the MC have the code...

Please excuse my stupidity and thanks for all your help!

Copyright © 2005-08 www.BigResource.com, All rights reserved