Welcome, Guest. Please login or register.
Did you miss your activation email?
31 Jul 2010, 11:33:25 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  Best Practice, OOP & MVC Frameworks (Moderators: flexy, Jan K, James)
| | |-+  is a OOPs
« previous next »
Pages: [1] Print
Author Topic: is a OOPs (Read 1024 times)
prashant
Senior FD
***
Posts: 197


« on: 29 Apr 2009, 10:15:44 UTC »

Code:
package
{

import flash.display.MovieClip;
import flash.events.MouseEvent;
import fl.data.DataProvider;
public class main  extends MovieClip
{
var obj:MovieClip = new background();


public function main ():void
{
var imageArr:Array = new Array();

addChild(obj);
obj.btnPrev.label="Previous";
obj.btnNext.label="Next";
obj.btnPrev.addEventListener(MouseEvent.CLICK , onPreviousClick);
obj.btnNext.addEventListener(MouseEvent.CLICK , onNextClick);
imageArr.push({ source:"img.png" , Data:"0" });
imageArr.push({ source:"img1.png" , Data:"0" });
imageArr.push({ source:"img2.png" , Data:"0" });
imageArr.push({ source:"img3.png" , Data:"0" });
imageArr.push({ source:"img4.png" , Data:"0" });
imageArr.push({ source:"img5.png" , Data:"0" });
obj.tileList.columnWidth = 100;
obj.tileList.rowHeight = 100;
obj.tileList.rowCount = 1;
obj.tileList.dataProvider =new DataProvider(imageArr);
obj.tileList.addEventListener(MouseEvent.CLICK , onImageClickHandler);
}
function onImageClickHandler(Mevt:MouseEvent)
{
obj.mainView.source = obj.tileList.selectedItem.source;
}

function onPreviousClick(Mevt:MouseEvent)
{
//var len:int= obj.tileList.dataProvider.length as int;
if(obj.tileList.selectedIndex >0)
{
obj.tileList.selectedIndex=obj.tileList.selectedIndex-1;
obj.mainView.source = obj.tileList.selectedItem.source;
}

}

function onNextClick(Mevt:MouseEvent)
{
//var len:int= obj.tileList.dataProvider.length as int;
if(obj.tileList.selectedIndex < obj.tileList.dataProvider.length-1)
{
obj.tileList.selectedIndex=obj.tileList.selectedIndex+1;
obj.mainView.source = obj.tileList.selectedItem.source;
}



}

}
}

please review my code and let me know is it a object oriented programming
« Last Edit: 29 Apr 2009, 17:29:57 UTC by flexy » Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 3,155


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #1 on: 30 Apr 2009, 09:07:49 UTC »

Yep, in a micro form, this is OOP  Smiley
Logged

Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC