JesterXL
By: a guest | May 12th, 2008 | Syntax:
ActionScript | Size: 1.61 KB | Hits: 419 | Expires: Never
package
{
// here strictly to allow ProgramVO's to work in a Flash CS3
// List. It arrogantly assumes that people don't mind
// adding properties to their VO's. Rather than modify
// our data model to work within a CS3 List, we make a new
// VO.
//
// If you're not as much as an OOP Purist as I am,
// then simply add these properties to the ProgramVO class.
import com.multicastmedia.vidego.vo.ProgramVO;
import flash.utils.Proxy;
import flash.utils.flash_proxy;
public class ProgramVOProxy extends Proxy
{
public var icon:*;
public var label:*;
public var program:ProgramVO;
public function ProgramVOProxy(program:ProgramVO):void
{
this.program = program;
}
flash_proxy override function getProperty(name:*):*
{
// if you need the original program, here you go!
if (name == "program")
{
return program;
}
// Rather than be a jerk, we attempt to give the List control
// a valid label
if (name == "label")
{
return program.metadatas.title;
}
// As long as you aren't asking for 'icon',
// we'll assume you're looking for ProgramVO data
if (name != "icon")
{
return program[name];
}
else
{
//... otherwise, it might be here... :: shrugs ::
// if not, BOOM!
return this[name];
}
}
flash_proxy override function setProperty(name:*, value:*):void
{
if (name == "program")
{
program = value;
}
if (name != "icon" && name != "label")
{
program[name] = value;
}
else
{
this[name] = value;
}
}
}
}