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




Class Structure



Hi, I'm working on my first game to use OOP in AS2 and I was wondering a little bit about subclasses. I plan to have more than one level of subclasses and was wondering how I should implement them together.Here is a little flow chart of the way i want the classes:Human.as|[character + "Specials.as"]|/ ["Player"+num+"Controls"]_________AI.as__________________ so basically it will go from Human.as which will contain all the basic game play functions, then based on what char is selected, it will load that chars Specials class, then finally which player is to control it or if it is AI.How would I set something like this up?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 05-07-2007, 11:41 PM


View Complete Forum Thread with Replies

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

[F8] Class Structure
I have had no luck in finding a tutorial, forum thread, or even book, that explains how to structure the class "skeleton" when creating an RIA. I want to create a website that is a 100% Flash enviroment. As I create each part of the site, i.e. navigation, php interaction, content format..., I find that I am going back and editing several class files, dropping functionality from them that I am covering with a new class. I am sure that there is some standard structure for class files in a full-Flash site, and I'm just not aware of it. I don't need a full tutorial on every detail, just a basic class structure. I am just tired of writing overlapping code. Also, seeing some structure examples would help me figure out the order of events I need to follow when I initialize the movie.

Oh, and maybe a basic structure for the base .fla also. There is a standard structure for writing class files, why can't I find one for writing a basic Flash website?

Any advice would be greatly appreciated. I am sure there are plenty of techniques better than the one I am using that would save me lots or rewriting code.
Thanks.

Using SetInterval In A Class Structure
I am looking for some insight into using setInterval in a class structure. Specifically, I want to use a class to draw a line incrementally, with input parameters to the class such as start point, end point and increment to grow the line by (amongst others).

I have attempt to create a class that does this, but have run into a problem with variable scope. I declared a number of variables that should be global in scope to the class. However, when those variables are referenced within the function called by setInterval, they become "undefined."

In the attached code, the variables start_X and start_Y are supposed to be incremented as the line grows toward end_X and end_Y. However, as soon as the call to the setInterval function is made, these variables go out of scope.

Am I using the setInterval functionality correctly, or is there an issue with using it in a class? Is there an easier method to use in creating a line that grows incrementally? (I eventually want to have functionality where the rate of growth can be changed by parameter).

thanks for insight into this problem

Waialua

ActionScript Code:
class line_Basic {
    private var line_mc:MovieClip;
    private var returnInterval:Number;
    private var start_X:Number;
    private var start_Y:Number;
    private var end_X:Number;
    private var end_Y:Number;
    private var line_IncrementX:Number;
    private var line_IncrementY:Number;
    private var line_Color:Number;
    private var line_Alpha:Number;
   
    //initialize variables
    public function line_Basic(movieClipDepth:Number) {
        line_mc = _root.createEmptyMovieClip("line", movieClipDepth);
    }
   
    public function set setStartPointX(initX:Number):Void {
        start_X = initX;
    }
    public function set setStartPointY(initY:Number):Void {
        start_Y = initY;
    }
    public function set setEndPointX(endX:Number):Void {
        end_X = endX;
    }
    public function set setEndPoint(endY:Number):Void {
        end_Y = endY;
    }
    public function set setIncrementX(incX:Number):Void {
        line_IncrementX = incX;
    }
    public function set setIncrementY(incY:Number):Void {
        line_IncrementY = incY;
    }
    public function set lineColor(lColor:Number):Void {
        line_Color = lColor;
    }
    public function set lineAlpha(lAlpha:Number):Void {
        line_Alpha = lAlpha;
    }

    public function line_Render():Void {
        line_mc.lineStyle(2, line_Color, line_Alpha);
        line_mc.moveTo(start_X, start_Y);
        start_X = start_X+line_IncrementX;
        start_Y = start_Y+line_IncrementY;
        returnInterval = setInterval(this, "line_Run", 4);
    }
    private function line_Run() {
       
        with (line_mc) {
            lineTo(start_X, start_Y);
            updateAfterEvent();
        if (start_X>=end_X and start_Y>=end_Y) {
                //clear the interval set for drawing the line
                clearInterval(returnInterval);
                //delete(onEnterFrame);
            }
            if (start_X<end_X) {
                start_X = start_X+line_IncrementX;
            }
            if (start_Y<end_Y) {
                start_Y = start_Y+line_IncrementY;
            }
        }
    }
}

Basic Class Structure
I've managed to create several applications in AS 3 without ever going face to face with packages and classes. I know that seems hard to believe, but anyway-- now I want to use something in the corelib and can't figure where I'm supposed to put these files I've downloaded. I know this is sub basic but would appreciate help.

Game Class Structure?
I recently started working on a simple 3D fps and I did some planning.
But I'm not entirely sure what's the best way to layout my classes.
I made a diagram but I'm not sure if it's right...

Is it wise to initialize all my classes in the Main class or should I initialize them from other classes that relate to them?

Anyway; here's a digram, please comment on the structure:

Compiling A Tree Class Structure
hi all, i need major help and advice(using MX Pro'04)

i basically need to compile infos of the tree structure so that i can import it as an XML into Flash.. A small portion of the tree coding is as follows..

//a recursive function for populating the tree from the SharedObject
function readSavedData(node,children){
var len = children.length;
for(var i = 0; ivar child = children[i];
//we saved out the label,data,and isBranch data, we restore that now
var newNode = new FTreeNode(child.label);
newNode.data = child.data;
if(child.isBranch) newNode.setIsBranch();
//add the new node
node.addNode(newNode);
//if it has children, recurse
if(child.children){
//a reference to this function
arguments.callee(newNode,child.children);
}
}
}

the entire tree coding is too long to display so i would greatly appreciate it if anyone can help by providing a coding solution for compiling the tree component info..

thanks a mil....

Simple Class Structure Question
Hi,

I have a very simple problem but am having trouble wrapping my mind around it in classes. In movieclips:

MC1 has a var working=true and contains MC2. If inside MC2 i type trace(_parent.working), it will trace true, simple enough, goes "up" a level by calling _parent.

Now I want to know if theres a "_parent" equiv for classes.

I can do the same thing with classes, but I have to pass a reference to the constructor:


PHP Code:



//tester1.as file
import com.tester2

class com.tester1 {
    public var working:Boolean = true;
    
    public function tester1() {
        var c2 = new tester2(this); //passing ref to itself as a param
        
    }
}






PHP Code:



//tester2.as file
class com.tester2 {
    public var working:Boolean = false;
    
    public function tester2(parent:Object) {
        working = parent.working;
        trace("working? "+working);
    }
}




This works, but I want to know if theres a way to w/o passing the reference. tester2 was initiated INSIDE tester1, so going "up" one level from tester2 would bring you to tester1, as it did with movieclips, but I have no clue how you would do it in classes, or if its even possible.

Thanks for the enlightenment!

Best Practices For Class Directory Structure?
I'm kind of new to OOP and am wondering if anyone has any tips on the best way to organize class directory structures. I've read that it's common to store your classes such as: com.mysite.utils

What are other common folders besides utils? Is there a general standard for this type of thing?

Also, a related question:
I understand a lot of people keep a main "Actionscript" or "Classes" folder on their machine. It's a nice way to keep all of your classes in a single location for later reuse.

On a project by project basis though, it's nice to have your classes in your project folder (for easy access and easy project delivery down the road). I guess I'm just wondering what the typical workflow is for this. Do you just copy classes you need from your main classes repository into a project folder?

Thanks for any tips on any of this!

Variable Scope Within AS2 Class Structure
I was just wondering if someone could clarify something for me. I've been trying to wrap my head around how the variable scope works within AS2 classes. Say for instance you have a class like such:


ActionScript Code:
class myClass {
     static private var __sText:String;
 
     public function myClass(){
          var myFunction:Function = function():Void{
               myClass.__sText = "Test";
          };
     }
}


My question is, do I have to declare a variable as static private for me to access it within the inline function myFunction? or is there another way?

(AS3) Class Structure/design/architecture Simple Question
So I am new to building full size applications and I am starting in AS3.
I bave a simple setup of one MC container that has 2 different elements generated by two different classes. I need those two inside elements to know information about each other...the text they contain, their partner's sizes etc. They are basically big friends and have lot to do with each other.

So, do i store an instance of each others class in a property? then they will just use getters and setters on those instances that are stored as properties. (class Y stores the instance of class X as a property)

or maybe i create a class that will encapsulate everything, and will take care of communication? that is, if X wants the width of Y, then it will call a function of the parent class that holds an instance of both X and Y and calls getters and setters?

Both of those seem like very inflexible composition pattern...

i am not very clear what best strategy would be... Can anyone with experience suggest?

Structure
hey there...

I have a movie on level0 that loads a movie on level1 a digital map.... when the user clicks on the desired location on the map a new movie appears on level0 and so forth corresponding movies on level1... Now I want to back (after the user has clicked a destination) to the original first movies on level0..

I have heard that unloading level0 or loading on top of it really doesn't work well with flash...

here is my question... How should I strucutre this site then? I have been suggeted to have a root movie witha container clip, but I did not understand this? any one please...

THX ..

DR

Structure
Can someone explain how I should structure a Flash site because i hear everyone talking about 'scenes' and stuff and all I do is put everything on the one animation. Cheers.

[F5] (AS1) XML Structure?
Hey people!

I'm pretty new with dealing with xml, so there might be a really easy solution, but I can't seem to be able to find it. The thing is - I have a flash file which structures data from this xml:


Code:
<?xml version="1.0" encoding="utf-8"?>
<real>
<rt o="order.vsp?itemId=10498&mode=RT" t="Jul+i+Skomakergata" p="Henki+Kolstad"

s="http://cpgw.paragallo.com/cpgw/getPreview.aspx?cguid=AC50AE5FD7E14C7FBE35E99CFA7BE9CB"/>
<rt o="order.vsp?itemId=1067624&mode=RT" t="Beggin" p="Madcon" s="/static/drm/bonnier/Madco-Begg-15089_real220k.mp3"/>
<rt o="order.vsp?itemId=58054&mode=RT" t="En+stjerne+skinner+i+natt" p="Oslo+Gospel+Choir" s="http://cpgw.paragallo.com/cpgw/getPreview.aspx?cguid=A45BFC7B67E040F7AA842B17B1F7D2F9"/>
<rt o="order.vsp?itemId=1009512&mode=RT" t="Apologize" p="Timbaland+ft.+Onere..."

s="http://medias.digiplug.net/medias/mp/10/web_mp3_32kbs_22khz_m/m763210.mp3"/>
<rt o="order.vsp?itemId=127898&mode=RT" t="Jingle+Bells" p="Christmas+%28Sinatra%29"

s="/static/aspiro/ringtone/real/prev/10420.mp3"/>
<rt o="order.vsp?itemId=189010&mode=RT" t="ALL+I+WANT+FOR+CHRISTMAS+IS+YO+..." p="Mariah+Carey"

s="/static/drm/sonybmg/partnersaspiroaudiomp3_prw/MariahCarey_AllIWantForChristmasIsYou.mp3"/>
<rt o="order.vsp?itemId=9631&mode=RT" t="Last+Christmas" p="George+Michael%2F+Wha..."

s="/static/drm/Wham!_LastChristmas.mp3"/>
</real>
<wmedia>
<ft o="order.vsp?itemId=10498&mode=RT" t="song" p="ft1"

s="http://cpgw.paragallo.com/cpgw/getPreview.aspx?cguid=AC50AE5FD7E14C7FBE35E99CFA7BE9CB"/>
<ft o="order.vsp?itemId=1067624&mode=RT" t="Beggin" p="ft2" s="/static/drm/bonnier/Madco-Begg-15089_real220k.mp3"/>
<ft o="order.vsp?itemId=58054&mode=RT" t="En+stjerne+skinner+i+natt" ft3"

s="http://cpgw.paragallo.com/cpgw/getPreview.aspx?cguid=A45BFC7B67E040F7AA842B17B1F7D2F9"/>
<ft o="order.vsp?itemId=1009512&mode=RT" t="Apologize" p="ft4"

s="http://medias.digiplug.net/medias/mp/10/web_mp3_32kbs_22khz_m/m763210.mp3"/>
<ft o="order.vsp?itemId=127898&mode=RT" t="Jingle+Bells" p="Christmas+%28Sinatra%29"

s="/static/aspiro/ringtone/real/prev/10420.mp3"/>
<ft o="order.vsp?itemId=189010&mode=RT" t="ALL+I+WANT+FOR+CHRISTMAS+IS+YO+..." p="Mariah+Carey"

s="/static/drm/sonybmg/partnersaspiroaudiomp3_prw/MariahCarey_AllIWantForChristmasIsYou.mp3"/>
<ft o="order.vsp?itemId=9631&mode=RT" t="Last+Christmas" p="George+Michael%2F+Wha..."

s="/static/drm/Wham!_LastChristmas.mp3"/>
</wmedia>
And I'm able to call the real tags, using just:
Code:
baseXML.firstChild.childNodes[m].attributes.t;
So if I do that it works with the REAL content...

but when i try to call the wmedia tags with
Code:
baseXML.firstChild.nextSibling.childNodes[m].attributes.t;
it doesnt work. See faulty code here:


Code:
function wmedia() {
for (m=0; m<4; m++) {
k=m%5;
//if (_root["item"+i] == undefined) {
cl = _root.attachMovie("item", "item"+m, m);
//}
cl.t = baseXML.firstChild.nextSibling.childNodes[m].attributes.t;
cl.p = baseXML.firstChild.nextSibling.childNodes[m].attributes.p;
cl.s = baseXML.firstChild.nextSibling.childNodes[m].attributes.s;
cl.o = baseXML.firstChild.nextSibling.childNodes[m].attributes.o;
//cl.artist.text = (i+1)+". "+unescape(cl.p.convert().substr(0,10)).toUpperCase()+".. - "+unescape(cl.t.convert()).toUpperCase();
cl.artist.text = (m+1)+". "+unescape(cl.p.convert().substr(0,10)).toUpperCase()+".. - "+unescape(cl.t.convert()).toUpperCase();
cl.n = m;
cl._y = 152+23*k;
cl._x = 8;
}
}

clip = _root.createEmptyMovieClip("container", 1);
clip.loadMovie("http://www.kenobi.se/flash/xmlproxy.swf");
What am I doing wrong? Thankful for any help

An OOP Structure
So here's what I'm trying to do: (in AS 2.0)

I have a movieclip called mc_drawshape. In that MC rests multiple circle movieclips which I call nodes (instance named "node1", "node2", etc). Now in my game, when one node is selected, you'll be able to drag your mouse in a drawing fashion to another node that is linked. All those nodes and links together form a shape.

So if I had a square, for example, with a node at each of the four corners, and the top left node was selected, then the player could go right or down towards the next node.

What I want is to be able to easily make a shape, which I can create nodes within, each of which have 1 or 2 linked nodes. So basically, in my mc_drawshape movieclip, if I have a frame, say it's called "square", I would put the 4 nodes where I want them to be, and then on the scripting side, I attach all the info to them.

So the structure I'm currently thinking of going with is having a class, say it's called Shape, and a class called Node. The Node class would extend Movieclip, and its constructor would pull in the assigned movieclip as an argument. This movieclip would be passed through AddNode, a memeber function of the Shape class.

So, for example...
var Square:Shape = new Shape();
Square.AddNode(mc_drawshape.node1);

And inside AddNode I would create the instance of the Node.

This is all I've been able to come up with myself, but I'm really, REALLY new to Object-Oriented Programming, so I'm not quite sure where to go from here. I have a lot of trouble knowing what functions or variables should go in which class...

The main things I'm missing is how to store which nodes are linked to a particular node. I'm also not sure how to manipulate specific nodes if I'm only creating instances of them within a Shape instance.

So any tips, ideas and suggestions would be greatly appreciated. In any case, I'll be returning to this thread often if there's any response. I'm hoping to learn a lot from this experience.

Thanks,
~ Pol

XML Structure
Hi,

I'm trying out the best way to strucure my XML document.

I need to have:

Sections (6)
sub sections (10)
thumbnail images (8)
main images (8)

Can anyone suggest how to write the xml for one of the six sections?

Cheers

Tab Structure
I add several instance of a clip from the library to a container clip on the stage, each instance has an input field within it and a button. I want to be able to move from one input field to the next with the tab key whilst skipping the buttons but can't make it work. I either tab between the button and the field repeatedly within one movie or cant tab anywhere (when tabIndex is set). Any thoughts on the subject please as I am stumped and pretty fed up with looking at it.

Cheers all

XML Structure
Hey
Is there someone who could tell me how to call this xml data from flash.
I usually use this:

Code:
<resources>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
...
</resources>

but I'd like to create something like this:




Code:
<resources>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
</resources>
<fora>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
</fora>
so how should I call the "resources" and "fora" data?


thanx

Structure Of Xml
How do I format the structure of xml

from:
<root><news><title>title text</title><body>body text</body></news></root>

to:
<root>
<news>
<title>title text</title>
<body>body text</body>
</news>
</root>

//code
var news_xml:XML = new XML();
news_xml.ignoreWhite = true;
AddNewsEntry();
//
function AddNewsEntry() {
var newsRoot:XMLNode = news_xml.createElement("root");
var newsNode:XMLNode = news_xml.createElement("news");
var titleNode:XMLNode = news_xml.createElement("title");
var bodyNode:XMLNode = news_xml.createElement("body");
var titleText:XMLNode = news_xml.createTextNode("title text");
var bodyText:XMLNode = news_xml.createTextNode("body text");
//
news_xml.appendChild(newsRoot);
newsNode.appendChild(titleNode);
newsNode.appendChild(bodyNode);
newsRoot.appendChild(newsNode);
titleNode.appendChild(titleText);
bodyNode.appendChild(bodyText);
}
//
trace(news_xml);

Structure Structure Structure
Hey there everyone,

I'm having trouble creating a good structure on my website. Currently I have it so I have the document class called Main.as. That loads all the preliminary stuff. I have a Homepage.as Class which has two addChild methods on the constructor. I make an instance of homepage on Main.as but it won't load the images! Why!?

On Main.as:

homePage = new HomePage();

On HomePage.as(constructor):

addChild(introText);
addChild(mainTent);

I'm I structuring this wrong. Should I have have a Homepage.as and a Contact.as, etc...

XML Structure
Hey
Is there someone who could tell me how to call this xml data from flash.
I usually use this:

Code:
<resources>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
...
</resources>

but I'd like to create something like this:




Code:
<resources>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
</resources>
<fora>
<item name="" description="" pic="" visit=""/>
<item name="" description="" pic="" visit=""/>
</fora>
so how should I call the "resources" and "fora" data?


thanx

Need Some Structure, Please Help
Okay, so I have this project that I have been working on since just after the earth cooled (not literally, but it feels like it). Because I have had the luxury of no deadlines on this project, I have taken full advantage of this and used the site to experiment and learn Flash. For that I am grateful.

My big problem, however is now that I feel like I could code just about anything that I would need to make a really dynamic, exciting site, I just can't decide where to start or how to structure things...Who would've guessed that all this time learning how to write some really cool code is useless when you can't pull it all together.

I can't decide if I should have a common preloader for all sections and a flyout menu to traverse between sections or if each section should have it's own preloader. Should I use XML to generate my configuration parameters or should I use a PHP/SQL system (which I have written a dozen of now to dynamically generate the config parameters)? Should my mainMenu be setup as an AbstractFactory whereby I can re-use it for each section in case there's a section menu? And then what about transitions? do I have a centralized transitionHandler that handles both the transitions between sections as well as any transitions between progressMeters? Or what about progressMeters? should I have one progress meter for loading sections and then each section can have a progressMeter or loading assets?

If you have ever been in this situation, I could use a word of encouragement, because now that I am finally feeling good about the programming skills, I feel the wind has been taken out of my sails that I can't make a simple website because I have too many options and too many ideas and no experience to guide me.

Could someone please gimme some advice about not only how to figure this out, but perhaps a simple structure that I can use (without analyzing it to death) that will get the job done and give me some idea about how to put it all together. A structure that would allow me to upgrade pieces without having to rework the entire system...

Any help would be greatly appreciated.

Thanks in advance,

jase

Structure
Im having a bit of trouble understanding how to structure a website in AS3.

Here is what i am trying to accomplish.

The splash page starts out in a maximum browser size. Loads a background image which i want to scale relatively and not distort, date and time bubble in with some filter effects, then title fades in. When user hits the enter button, the background changes, and main UI loads centered on page.

Im guessing all this can be done with 1 frame, and all the tweens can be controlled from the main.as class??

So looking at this I imagine the structure of the site like this.

Main.fla
main.as - sets up the stage properties and utilizes all other classes?

then custom classes

date.as for displaying the date and time. ( not sure if i should incorporate the transition effects into this or make new class)
transition.as - for creating the transition effects for date/time and title fade in.
loader.as - for loading the background image
preloader.as - creates a custom preloader

would this be correct, or am i tottaly wrong here.

Structure
Im having a bit of trouble understanding how to structure a website in AS3.

Here is what i am trying to accomplish.

The splash page starts out in a maximum browser size. Loads a background image which i want to scale relatively and not distort, date and time bubble in with some filter effects, then title fades in. When user hits the enter button, the background changes, and main UI loads centered on page.

Im guessing all this can be done with 1 frame, and all the tweens can be controlled from the main.as class??

So looking at this I imagine the structure of the site like this.

Main.fla
main.as - sets up the stage properties and utilizes all other classes?

then custom classes

date.as for displaying the date and time. ( not sure if i should incorporate the transition effects into this or make new class)
transition.as - for creating the transition effects for date/time and title fade in.
loader.as - for loading the background image
preloader.as - creates a custom preloader

would this be correct, or am i tottaly wrong here.

How To Structure Function
hi

i'm having trouble with how to write functions...

i've got a mc called ball3 - if i write the function like this...

function setDrag () {
if (_root.firstDrag == true && _root.isDrag == true) {
ball3._y = control._y;
ball3._x = control._x;
}
}

... & call it like this...

_root.setDrag ();

... it works fine

but like this...

function setDrag (nameIt) {
if (_root.firstDrag == true && _root.isDrag == true) {
nameIt._y = control._y;
nameIt._x = control._x;
}
}

... and calling it like this

_root.setDrag (ball3);

... it doesn't work

does anyone know why???

thanks for your help

Help Structure Scene.
hi, thanks for reading this.

I have a 1 scene movie, 1 layer with 1 frame. In the frame, I added an audio mc i want to loop, some animations and a clock. The movie works fine as a stand alone scene.

I added a new scene with a preloader. Now, after preloader loads mainscene, I get a loop back to preloader, so I added a stop frame to my main scene to prevent the loop, and that kills my animation.

Here's my question, How can I properly add a command so that my mainscene doesn't loop back to the scene before it (preloader)? I've tried using a stop command before, after and on the same frame as the main scene -- I kill the loop, but it stop's my animation. Any ideas?

Thanks for your time and help

XML & Array Structure
All these childNodes, firstChild & nextSibling seem pretty streight forward, but for some reason I can't get any other variable than -number- in each -lot- to trace. I have setup the other arrays the same as -lot- as a starting point. Can anyone help me with the arrays to get the status, size & price of each -lot-?

Here is my XML:
-?xml version="1.0" ?-
-retreat-
-lot-
-number-1-/number-
-status-a-/status-
-size-0.65-/size-
-price-$65,000-/price-
-/lot-
-lot-
-number-2-/number-
-status-a-/status-
-size-0.55-/size-
-price-$95,000-/price-
-/lot-
-lot-
-number-3-/number-
-status-a-/status-
-size-0.75-/size-
-price-$75,000-/price-
-/lot-
-lot-
-number-4-/number-
-status-a-/status-
-size-0.85-/size-
-price-$99,000-/price-
-/lot-
-lot-
-number-5-/number-
-status-a-/status-
-size-0.32-/size-
-price-$62,000-/price-
-/lot-
-/retreat-*/

Here is my script:
lotvars = new XML();
lotvars.load("lot_retreat.xml");
lotlist = new Array();
statuslist = new Array();
sizelist = new Array();
pricelist = new Array();

function myOnLoad () {
lotlist = lotvars.firstChild.childNodes;
statuslist = lotvars.firstChild.childNodes;
sizelist = lotvars.firstChild.childNodes;
pricelist = lotvars.firstChild.childNodes;

trace ("lotlist [0].fc.fc.nv: "+lotlist [0].firstChild.firstChild.nodeValue);
trace ("statuslist [0].fc.fc.nv: "+statuslist [0].firstChild.firstChild.nodeValue);
trace ("sizelist [0].fc.fc.nv: "+sizelist [0].firstChild.firstChild.nodeValue);
trace ("pricelist [0].fc.fc.nv: "+pricelist [0].firstChild.firstChild.nodeValue);
trace ("lotlist [1].fc.fc.nv: "+lotlist [1].firstChild.firstChild.nodeValue);
trace ("statuslist [1].fc.fc.nv: "+statuslist [1].firstChild.firstChild.nodeValue);
trace ("sizelist [1].fc.fc.nv: "+sizelist [1].firstChild.firstChild.nodeValue);
trace ("pricelist [1].fc.fc.nv: "+pricelist [1].firstChild.firstChild.nodeValue);
trace ("lotlist [2].fc.fc.nv: "+lotlist [2].firstChild.firstChild.nodeValue);
trace ("statuslist [2].fc.fc.nv: "+statuslist [2].firstChild.firstChild.nodeValue);
trace ("sizelist [2].fc.fc.nv: "+sizelist [2].firstChild.firstChild.nodeValue);
trace ("pricelist [2].fc.fc.nv: "+pricelist [2].firstChild.firstChild.nodeValue);
trace ("lotlist [3].fc.fc.nv: "+lotlist [3].firstChild.firstChild.nodeValue);
trace ("statuslist [3].fc.fc.nv: "+statuslist [3].firstChild.firstChild.nodeValue);
trace ("sizelist [3].fc.fc.nv: "+sizelist [3].firstChild.firstChild.nodeValue);
trace ("pricelist [3].fc.fc.nv: "+pricelist [3].firstChild.firstChild.nodeValue);
trace ("lotlist [4].fc.fc.nv: "+lotlist [4].firstChild.firstChild.nodeValue);
trace ("statuslist [4].fc.fc.nv: "+statuslist [4].firstChild.firstChild.nodeValue);
trace ("sizelist [4].fc.fc.nv: "+sizelist [4].firstChild.firstChild.nodeValue);
trace ("pricelist [4].fc.fc.nv: "+pricelist [4].firstChild.firstChild.nodeValue);
}
lotvars.onLoad = myOnLoad;
lotvars.ignoreWhite=1
stop ();

If Structure Problem
why does it always forward?

here is my actionscript
i load a variable from asp and if it plze then it has to go to main.htm


errormsg = "";
var rn = Math.round(Math.random()*1000000);
loadVariablesNum ("../asp/login.asp?reload="+rn, 0);
if (errormsg eq plze) {
getURL ("../gevorst/html/main.htm");
}
stop ();

could anyone help me out here tnx

J-ke

Cd-rom Structure - Loadmovie
hi,

okay, i have a movie/swf that is basically outside of a folder which contains the data and other swf's of the cd-rom. the problem is that i cant seem to load the next swf that is in the data folder.

its says in the flash help that i cant load another movie/swf if it resides in a folder, it has to be in the same folder as the original swf.. is this true? if so the front end of my cd-rom is gona look well messy as i have a s**t load of files that it loads up.

the front end looks like...

----------------------------------------------
start.exe (flash projector)
data (folder containing all other swf & jpegs)
autorun.inf
----------------------------------------------

any help would be great!

Movie Structure
Hey, All

I'm probably making this hard then it really is, but I've exausted all creative ideas of solving this, so I'm at flashkit.

I've got a movie: http://www.khaus.com/flash.htm: prolly to big to attach.

Q. Got a movie with a few layers in Scene 1. Staggered like so:

NAVA NAVA
-ONE
--TWO
---THREE


NAVA =the navagation
ONE =drag'n drop objects
TWO =movie clip. selects a background number, in a rollover fashion
THREE =background RBG color slider/changer.


Problem is when you open the movie you see THREE first. Ok, change background color. Then you go to TWO. Select a background number. Ok, now go to THREE, drag'n drop item. Ok good so far. QQQuestion/PPProblem is when you go back to THREE from ONE or TWO you lose the background number selected. What can I do to keep the selection from TWO present at when going back to THREE?

Thanks in advance.
K

Structure Challenge
Hey, All

I'm probably making this hard then it really is, but I've exausted all creative ideas of solving this, so I'm at flashkit.

I've got a movie: http://www.khaus.com/flash.htm: prolly to big to attach.

Q. Got a movie with a few layers in Scene 1. Staggered like so:

NAVA NAVA
-ONE
--TWO
---THREE


NAVA =the navagation
ONE =drag'n drop objects
TWO =movie clip. selects a background number, in a rollover fashion
THREE =background RBG color slider/changer.


Problem is when you open the movie you see THREE first. Ok, change background color. Then you go to TWO. Select a background number. Ok, now go to THREE, drag'n drop item. Ok good so far. QQQuestion/PPProblem is when you go back to THREE from ONE or TWO you lose the background number selected. What can I do to keep the selection from TWO present at when going back to THREE?

Thanks in advance.
K

Site Structure
I am designing a flash site, using a lot of external swfs that load into empty mcs. It is a large enough site that I have a lot of folders and subfolders to keep it organized.

My problem is that using loadMovie is easy when everything is in the same folder, but it is extremely tedious when I have to figure out the path to everything with all of my subfolders. The question is:
should I be putting everything in the same folder for ease of writing?
should I quit whining and go through the tedium of figuring out all the paths?
or am I missing an easier way to do this?

In other words, how does everyone else do this?

Movie Structure
any suggestions for the structure of how i can do this type of movie?

4 options on an initial menu screen
ie (colors, numbers, letters, vehicles)

each option brings the user to a yes or no option (happens for 50+ frames per initial menu option)

i thought that structuring each menu item as a seperate scene would work well for categorical reasons due to the large number of frames used, but that turned out to be a huge mess. i was wondering if anyone had any suggestions on how to structure differently.

any suggestions?

Movie Structure
any suggestions for the structure of how i can do this type of movie?

4 options on an initial menu screen
ie (colors, numbers, letters, vehicles)

each option brings the user to a yes or no option (happens for 50+ frames per initial menu option)

i thought that structuring each menu item as a seperate scene would work well for categorical reasons due to the large number of frames used, but that turned out to be a huge mess. i was wondering if anyone had any suggestions on how to structure differently.

any suggestions?

Best Structure For Streaming?
I'm creating a large online annual report which will incorporate over 70 pages of text and charts as well as music into one online presentation. It has to be set up in such a way that allows it to stream relatively quickly and I was wondering what would be the best way to set it up? Am I better off breaking each section into a separate .swf?

Any advice would be greatly appreciated.

Thanks,
Kosmo

File Structure
When I upload my flash files to the web is there any structure I need to use? Naming the main html 'index' etc.

Seb

.fla Structure Corrupted?
I'm fairly new to using Flash, and have been having a problem with a fairly large movie I spent quite a lot of time on.
After re-installing my O/S any trying to edit the .fla all the layers had been replaced by two empty ones and nothing else, all the components are still in the library but the structure has dissapeared completely.
I saved two different versions; one with hi-res movie footage and the other with low-res, but both have exactly the same problem.

Did I do something wrong saving the .fla or am I missing something obvious?
Any help and advice would be greatly appreciated.

.fla Structure Corrupted?
I'm fairly new to using Flash, and have been having a problem with a fairly large movie I spent quite a lot of time on.
After re-installing my O/S any trying to edit the .fla all the layers had been replaced by two empty ones and nothing else, all the components are still in the library but the structure has dissapeared completely.
I saved two different versions; one with hi-res movie footage and the other with low-res, but both have exactly the same problem.

Did I do something wrong saving the .fla or am I missing something obvious?
Any help and advice would be greatly appreciated.

P.S Sorry for the double post, but was told I might get better luck posting on here rather than in the newbie forum!

Data Structure
Hello,

i am trying to hold some data in flash and i would like to know if there is any data structure that i can use besides arrays?

Thanks,
Miguel

Tree Structure...
I am developing an interface, which will allow navigation between quite a lot of samples. Having done a few experiments previously I am of the opinion that generating the buttons in script from some sort of array would be best.
If my structure would be something like this


Code:
A---1---xA.1.1
---xA.1.2
---xA.1.3
---2---xA.2.1
---xA.2.2
B---1---xB.1.1
---2---xB.2.1
---xB.2.2
etc. etc.


would the best way of representing it be


Code:
main = newArray()
main[0]= null
main[1]= [ ["xA.1.1", "xA.1.2", "xA.1.3"], ["xA.2.1", "xA.2.2"] ]
main[2]= [ ["xB.1.1", ["xB.2.1", "xB.2.2"] ]
and so on,

I also realise that if I use objects I could hold other information, but I guess really what I'm asking is, is there a different or better way of doing this?

RE:movie Structure
first site teething problems...
I’ve created a kinetic navigation system with moving movie clips that stop on a rollova… the clips are 2 levels above the root level. I’m trying to get them to tell the main timeline to pop bak to scene one. Current script attached to the button movies looks like this:

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
_parent.gotoAndStop("scene 1", 1);
trace(“click”);
}
}

The output window says “click” but no scene 1..HELP!!

I tried putting a button at the root level and with on (release)…gotoandstop etc. and it works ok…

I then tried targeting a movie clip with two frames that I placed on the main stage.. I can control the clip with the buttons. So why can't I jump back to the scene one? This is very frustrating!

I'm currently using the scenes to divide up my content with a seperate preloader for each scene.. maybe I should use individual movies with the loadMovie thingi instead? I'd really like to know why my movie won't work in its current state tho!
Any explination will probably save my computer, my monitor and perhaps myself from being ejected from my bedroom window.. and would be most appreciated!
Cheers..

Nik

If Statement Structure.
Hi,

so heres what i am trying to do:


onClipEvent (enterFrame) {
if (_root.newsday < 2) {
if(this._alpha>50){
this._alpha-=5;

} else {
this._alpha = 100;
}
}

clearly not going to work so how do i refer to a if statement within a if statement?


cheers,
G

How Would You Structure My Movie?
Hi all,

I'd like your input on that one, you expert flash geeks

I wanna to do something I consider to be complex. But, then I'm not yet a flash geek, but I'm hoping to become one very soon So maybe it's simple after all.

I have a main menu. From there the user can access section 1, section 2 or section 3. Each of these sections have a certain number of frames with different images (let's call them sub-sections : 1.1, 1.2, 1.3 and so on).

I want to create a play all button that would play all the frames (sub-sections) in sequence up to the end of that section. Then it would have to jump back to the main menu.

Also, I want the user to be able to interrup at any time the automatic play by pressing the Esc key. it would then jump back to the main menu. while resetting the play all button.

And finally, I want the users to be able to navigate by themselves (manually) on the site. I want to give them the full power of choosing which sections (and sub-sections) they want to see. They would have to be able to watch sub-section 1.4 and in less that 2 clicks be able to jump to sub-section 3.5, for instance.

(by the way, that last part I know how to do, it's just how to make it work along with the automatic thing) (how to override the stop() function.

Could I possibly use 2 different scenes? I've been warned about using scenes... I would prefer not to. it would probably means more work with scenes.

Thanks a lot for your help

How To Structure A Website?
Hi

Ive just read sam's teach yourself flash in 24 hours, thats the only knowledge of flash i have so far. Its introduced me to the concepts, but now ive finished the book and want to sit down and make a website i have no idea how to set it up?

I want a menu with options to goto different part of the website, but i have no idea how to achieve this. Do i make one big timeline and label the starting frame of each new page of the website and then 'goto' it when a button is pressed? Or do i put each page in a new scene and goto the scene when a button is pressed? Or do i even make different swf's for each page and link them together?

Thanks in advance
john

Design And Structure Of AS 2.0
Hi,

i'm just starting to get my head around OOP and AS2.0. I want to create a number of classes and sub classes, where the methods might vary from project to project. Now what I don't know is do I just lump all the varying methods into the classes as I do them in each project, or is their a way that the classes can pull in what methods they need dynamically, or I am getting this OOP business all wrong?!?

thanks for any advice.

boombanguk

Directory Structure
I'm looking for a way to reference movie clips in a directory that is not a child of the flash root directory.

I have the SWF file in a "SWF" folder which is on the server root. Then also on the server root is an "images" folder. I'm calling the loadMovie() procedure to load images, but want to be able to load images from the "images" folder.

I can't just specify a relative path, as the swf defaults the root directory to the directory the file is located. I attempted the old Unix trick of setting the path to "../Images" but flash doesn't like that. Right now the only options is to set the path as an absolute, using the full "Http://" address, but that means I'd have to go back and change every single instance when I transfer the project over to the main server.

anyone know how to do this?

Site Structure
Less of a question but more of an inquirey, would anyone have a good clue how a site like this. http://www.trevorjackson.org was put together.

In terms of site structure and the way it loads so quickly, was the timeline broken up with external loading movie clips etc.

appreciate any thoughts

Cheers

Structure Of A Game In AS3
Hi, I'm starting to get familiar with AS3 elements, but I'm stuck when it comes to building a code structure for my game.

In a game consisting of a game menu (with settings, high scores etc.) and the actual game with several levels, where the menu is written in one class or one package, and the game itself in one or several others, what's a good way to jump between the menus and the game, and between the levels etc.? In AS2, I used one set of frames for the menu, and one for the game. I don't want to use the frames like that any more.

The Best Site Structure?
Hello everyone and Happy new year!!

Im not that new to flash but im not that experienced either.

Im currently designing a website that will host photographs in Flash.

i was wondering what would be the best way to develop the site? how should i structure the site??

im not sure which is the best way, because in the "work" page there is a number o different external slideshows i will be showing.

below is the site map of what im trying to achieve.

has anyone done anything like this before that can give me any advise please?

Best Way To Structure A Menu
I'm making a flash app which is basically just a menu (main screen). When you select a button, a new sub-menu should show up.

What I'm wondering is, what's the best structure for setting something like this up?

Should I have a movieHolder and load each menu in as required?

Also, I'm trying to think of a good intro & outro for each menu. Does anyone have any cool examples that might inspire me?

As of right now I'll probably just go with a simple fade-in + fade-out.

Demo Cd Structure
Hi guys, I'm creating a demo CD but have got a little stuck. I have some self contained flash applications and they need to be put onto a cd.

I want to autorun the cd, so a menu screen comes up where you can select which application you want to run.

However i can't think how to do it. I can't really load each application into a main one as a lot will need changing in each application to get them to work with regards to scoping issues.

Does anyone have any ideas about the best way to do this?

Could i run the main menu at startup, then when you select an application that application starts up and the other one closes?

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