Welcome, Guest. Please login or register.
Did you miss your activation email?
05/23/12, 12:31
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Expanding the possibility of the tutorial
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Expanding the possibility of the tutorial  (Read 1113 times)
James S Atlas
Server what's that
*
Posts: 1



View Profile Email
« on: 07/09/04, 21:25 »

I am following the great tutorial in this site at http://www.flash-db.com/Tutorials/loading/loadingData.php?page=3, and I try to develop them according to my project. Thanks for the tutorial!

Here is my mymenu.xml

Code:
<?xml version="1.0"?>
<PORTFOLIO>
   <section    name="ABOUT"
         text ="content/images/description1.txt"
         picture="content/images/pic2.jpg"
    />
   <section    name="COMPANY"
         text ="content/images/description2.txt"
         picture="content/images/pic1.jpg"
   />
</PORTFOLIO>

and here is the actionscript:

Code:
contenttext = this;
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
   if (success){
      menuSection = this.firstChild.childNodes;
      for (var i=0; i<menuSection.length; i++) {
         item = menu.attachMovie("itemClip", "itemClip" + i, i);
         item._x = 0;
         item._y = i*22;
         item.itemLabel.text = menuSection[i].attributes.name;
         item.text = menuSection[i].attributes.text;
         item.picture = menuSection[i].attributes.picture;
         //item.myUrl = menuSection[i].attributes.url;
         item.onRelease = function() {
            info_txt.text = "LOADING...";
            contenttext.loadVariables(this.text);
            containerMC.loadPic(this.picture);
         }
      }
      containerMC.loadPic(menuSection[0].attributes.picture);
      contenttext.loadVariables(menuSection[0].attributes.text);
   } else {
      loadText.text = "ERROR!";
   }
}

menuXml.load("xmlstuff/myMenu.xml");

I want to make this project having lots of freedom in terms of how each menu item will react upon onRelease.

To illustrate my idea, Please kindly have a look at
Code:
item.onRelease=function()
{ }

Instead of  having to have what is there,  I want the onRelease function to have choices. My idea is that is going to be look like this :

Code:
item.onRelease=function(){

choice of actions();

}

then I can declare the choice of actions(); like

action_one.onRelease=function(){
            info_txt.text = "LOADING...";
            contenttext.loadVariables(this.text);
            containerMC.loadPic(this.picture);
}


action_two.onRelease=function(){
            info_txt.text = "LOADING...";
thumbnail.createThumbnail(this.thumbnail);
            containerMC.loadMovie(this.picture);
            getURL(this._blank);
}


I hope that snippets and the illustration able to show what I want to do.

So please, someone so kind helping me :

1. How to change the general item.onRelease funtion above to the item.onRelease with choice of actions, but all the attributes still intact?

2. How to decalre the action_one.function and action_two.function in order that each of the function has different kind of functions of function?

3. I will obviously will have to change mymenu.xml above to have attributes point out to the action. Can you please show me/rework that structure?


This is my first post and I hope it's not burried in the weekend avalanches.
Thanks a lot for your help.

« Last Edit: 07/09/04, 21:26 by James S Atlas » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 07/12/04, 02:46 »

Hi James, welcome to the Boards !

In order to switch inside a for ..loop you need to have conditions to meet (if statement) Which are the conditions to choice action one or action two?

Jorge
Logged

Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!