imam problem sa DocumentClass-om flasha.
DOCUMENTCLASS
Code:
package
{
import com.gskinner.motion.GTweenFilter;
import flash.display.MovieClip;
import com.gskinner.motion.GTween;
import flash.filters.GlowFilter;
import fl.motion.easing.*;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
/**
* ...
* @author
*/
public class NekoIme extends MovieClip
{
//Main elemnets
public var portfolio:Portfolio;
//Measurement variables
public static var sirina:Number;
public var visina:Number;
public var centarX:Number;
public var centarY:Number;
// Main buttons variables
public var portfolioButton:PortfolioBtn = new PortfolioBtn();
public var blogButton:BlogBtn = new BlogBtn();
public var sandButton:SandBtn = new SandBtn();
//Graphic assets variables
public var logoBar:LogoBar = new LogoBar();
//filters variables
public var buttonYellowGlow:GlowFilter = new GlowFilter(0xFFFF00, 0, 0, 0,1);
public var buttonRedGlow:GlowFilter = new GlowFilter(0xFF0000, 0, 0, 0, 1);
public function NekoIme()
{
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function onStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onStage);
setStage();
}
public function setStage():void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResize, false, 0, true);
centarX = stage.stageWidth / 2;
centarY = stage.stageHeight / 2;
sirina = stage.stageWidth;
visina = stage.stageHeight;
addItems();
PositionItemsIndexState();
}
public function onStageResize(e:Event):void
{
centarX = stage.stageWidth / 2;
centarY = stage.stageHeight / 2;
sirina = stage.stageWidth;
visina = stage.stageHeight;
PositionItemsIndexState();
}
public function addItems():void
{
logoBar.x = centarX;
logoBar.y = -500;
addChild(logoBar);
portfolioButton.x = -100;
portfolioButton.y = centarY;
blogButton.x = centarX;
blogButton.y = visina+100;
sandButton.x = sirina+100;
sandButton.y = centarY;
addChild(portfolioButton);
addChild(blogButton);
addChild(sandButton);
portfolioButton.filters = [buttonYellowGlow, buttonRedGlow];
blogButton.filters = [buttonYellowGlow, buttonRedGlow];
sandButton.filters = [buttonYellowGlow, buttonRedGlow];
portfolioButton.addEventListener(MouseEvent.MOUSE_OVER, onPortfolioButtonOver);
portfolioButton.addEventListener(MouseEvent.MOUSE_OUT, onPortfolioButtonOut);
portfolioButton.addEventListener(MouseEvent.CLICK, onPortfolioButtonClicked);
blogButton.addEventListener(MouseEvent.MOUSE_OVER, onBlogButtonOver);
blogButton.addEventListener(MouseEvent.MOUSE_OUT, onBlogButtonOut);
blogButton.addEventListener(MouseEvent.CLICK, onBlogButtonClicked);
sandButton.addEventListener(MouseEvent.MOUSE_OVER, onSandButtonOver);
sandButton.addEventListener(MouseEvent.MOUSE_OUT, onSandButtonOut);
sandButton.addEventListener(MouseEvent.CLICK, onSandButtonClicked);
}
public function PositionItemsIndexState():void
{
new GTween(logoBar, 2, { x:centarX, y:149 }, { ease:Sine.easeOut } )
new GTween(portfolioButton, 3, { x:centarX - 200, y:centarY }, { ease:Back.easeOut });
new GTween(blogButton, 3, { x:centarX-35, y:centarY }, { ease:Back.easeOut });
new GTween(sandButton, 3, { x:centarX+130, y:centarY }, { ease:Back.easeOut });
}
public function PositionItemsPortfolioState():void
{
new GTween(logoBar, 2, { x:centarX, y:-125 }, { ease:Sine.easeIn } )
new GTween(portfolioButton, 3, { x:sirina - 360, y:30 }, { ease:Back.easeInOut } );
new GTween(blogButton, 3, { x:sirina-240, y:30 }, { ease:Back.easeInOut, delay:1.5 } );
new GTween(sandButton, 3, { x:sirina-120, y:30 }, { ease:Back.easeInOut, delay:3 } );
}
//click handlers
//===================================================================================================
public function onPortfolioButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onPortfolioButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onPortfolioButtonClicked(e:MouseEvent):void
{
PositionItemsPortfolioState();
portfolio = new Portfolio();
addChild(portfolio);
}
public function onBlogButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onBlogButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onBlogButtonClicked(e:MouseEvent):void
{
}
public function onSandButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onSandButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onSandButtonClicked(e:MouseEvent):void
{
}
}
}
package
{
import com.gskinner.motion.GTweenFilter;
import flash.display.MovieClip;
import com.gskinner.motion.GTween;
import flash.filters.GlowFilter;
import fl.motion.easing.*;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
/**
* ...
* @author
*/
public class NekoIme extends MovieClip
{
//Main elemnets
public var portfolio:Portfolio;
//Measurement variables
public static var sirina:Number;
public var visina:Number;
public var centarX:Number;
public var centarY:Number;
// Main buttons variables
public var portfolioButton:PortfolioBtn = new PortfolioBtn();
public var blogButton:BlogBtn = new BlogBtn();
public var sandButton:SandBtn = new SandBtn();
//Graphic assets variables
public var logoBar:LogoBar = new LogoBar();
//filters variables
public var buttonYellowGlow:GlowFilter = new GlowFilter(0xFFFF00, 0, 0, 0,1);
public var buttonRedGlow:GlowFilter = new GlowFilter(0xFF0000, 0, 0, 0, 1);
public function NekoIme()
{
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function onStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onStage);
setStage();
}
public function setStage():void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResize, false, 0, true);
centarX = stage.stageWidth / 2;
centarY = stage.stageHeight / 2;
sirina = stage.stageWidth;
visina = stage.stageHeight;
addItems();
PositionItemsIndexState();
}
public function onStageResize(e:Event):void
{
centarX = stage.stageWidth / 2;
centarY = stage.stageHeight / 2;
sirina = stage.stageWidth;
visina = stage.stageHeight;
PositionItemsIndexState();
}
public function addItems():void
{
logoBar.x = centarX;
logoBar.y = -500;
addChild(logoBar);
portfolioButton.x = -100;
portfolioButton.y = centarY;
blogButton.x = centarX;
blogButton.y = visina+100;
sandButton.x = sirina+100;
sandButton.y = centarY;
addChild(portfolioButton);
addChild(blogButton);
addChild(sandButton);
portfolioButton.filters = [buttonYellowGlow, buttonRedGlow];
blogButton.filters = [buttonYellowGlow, buttonRedGlow];
sandButton.filters = [buttonYellowGlow, buttonRedGlow];
portfolioButton.addEventListener(MouseEvent.MOUSE_OVER, onPortfolioButtonOver);
portfolioButton.addEventListener(MouseEvent.MOUSE_OUT, onPortfolioButtonOut);
portfolioButton.addEventListener(MouseEvent.CLICK, onPortfolioButtonClicked);
blogButton.addEventListener(MouseEvent.MOUSE_OVER, onBlogButtonOver);
blogButton.addEventListener(MouseEvent.MOUSE_OUT, onBlogButtonOut);
blogButton.addEventListener(MouseEvent.CLICK, onBlogButtonClicked);
sandButton.addEventListener(MouseEvent.MOUSE_OVER, onSandButtonOver);
sandButton.addEventListener(MouseEvent.MOUSE_OUT, onSandButtonOut);
sandButton.addEventListener(MouseEvent.CLICK, onSandButtonClicked);
}
public function PositionItemsIndexState():void
{
new GTween(logoBar, 2, { x:centarX, y:149 }, { ease:Sine.easeOut } )
new GTween(portfolioButton, 3, { x:centarX - 200, y:centarY }, { ease:Back.easeOut });
new GTween(blogButton, 3, { x:centarX-35, y:centarY }, { ease:Back.easeOut });
new GTween(sandButton, 3, { x:centarX+130, y:centarY }, { ease:Back.easeOut });
}
public function PositionItemsPortfolioState():void
{
new GTween(logoBar, 2, { x:centarX, y:-125 }, { ease:Sine.easeIn } )
new GTween(portfolioButton, 3, { x:sirina - 360, y:30 }, { ease:Back.easeInOut } );
new GTween(blogButton, 3, { x:sirina-240, y:30 }, { ease:Back.easeInOut, delay:1.5 } );
new GTween(sandButton, 3, { x:sirina-120, y:30 }, { ease:Back.easeInOut, delay:3 } );
}
//click handlers
//===================================================================================================
public function onPortfolioButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onPortfolioButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onPortfolioButtonClicked(e:MouseEvent):void
{
PositionItemsPortfolioState();
portfolio = new Portfolio();
addChild(portfolio);
}
public function onBlogButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onBlogButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onBlogButtonClicked(e:MouseEvent):void
{
}
public function onSandButtonOver(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:1, blurX:15, blurY:10, strength:1 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:1, blurX:20, blurY:15, strength:1 }, { filterIndex:1 } );
}
public function onSandButtonOut(e:MouseEvent):void
{
new GTweenFilter(e.target, 1, { color:0xFFFF00, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:0 } );
new GTweenFilter(e.target, 1, { color:0xFF0000, alpha:0, blurX:0, blurY:0, strength:0 }, { filterIndex:1 } );
}
public function onSandButtonClicked(e:MouseEvent):void
{
}
}
}
SUBCLASS
Code:
package
{
import flash.display.MovieClip;
import NekoIme;
/**
* ...
* @author
*/
public class Portfolio extends NekoIme
{
public function Portfolio()
{
trace("do ovog trace-a ne stize");
}
}
}
package
{
import flash.display.MovieClip;
import NekoIme;
/**
* ...
* @author
*/
public class Portfolio extends NekoIme
{
public function Portfolio()
{
trace("do ovog trace-a ne stize");
}
}
}
Naime pozivanjem klase Portfolio iz NekoIme klase flashDebbuger mi vraca gresku
Error: Error #2136: The SWF file file://...putanja do fajla...//master.swf contains invalid data at NekoIme/onPortfolioButtonClicked()
Moze li neko da me posavetuje, kako da resim problem ili barem ukaze na to sta izaziva gresku, jer se sa nemogucnoscu extendovanja klase jos nisam sreo.
[Ovu poruku je menjao shedvel dana 07.08.2009. u 13:22 GMT+1]
[Ovu poruku je menjao shedvel dana 07.08.2009. u 13:22 GMT+1]
"Treba li da se smejem jer smesni su, . . .
. . . ili da placem jer je to sve sto jesu? "
. . . ili da placem jer je to sve sto jesu? "