[Flashcoders] letter spacing on input text

2007-08-07 Thread ilteris kaplan

Dear Flashcoders,

I have stumbled across an interesting issue when I was looking for  
different ways of creating an input box. The way I chose, is because  
it's the simplest one is to crete it on the authoring time. The path  
that I followed was simple, I Created three textboxes, converted them  
into input text, set their text spacing to 5, and their alpha to 78.  
and select some font and embed certain latin characters.  Then I put  
some text in the box too. and when I test this piece, unfortunately  
it's giving me total random results.


http://share.klaweht.com/placeholder.swf

here's the swf file I uploaded. First of all, it doesn't load with  
alpha in the beginning. If I go ahead and do a backspace on any of  
the text box and delete the text and start typing again, if it's the  
first attempt, it works without alpha and with correct letter  
spacing. BUT, when I press tab to move into the next textBox, and  
delete the contents and try to type, it gives me the correct alpha  
and 0 text letter spacing. If you try to rerun this swf, you will see  
that it gives you those in random order.


I don't really know what's going. I don't like to jump so quickly  
that to tell this is a bug but I am really curious to see what you  
got. If I create everything in the code, it works fine by the way.


Please let me know your results.
best,
ilteris

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] textfield woes.

2007-08-06 Thread ilteris kaplan

Hello List,
Very basic question.
Basically I created a new font in my flash library and put this code  
in the timeline.


this.createTextField(mytext, this.getNextHighestDepth(), 10, 100,  
300, 200);

mytext.multiline = false;

mytext.type = input;
mytext.embedFonts = true;
mytext.restrict = 1,2,3,4,5,6,7,8,9,0;
mytext.border = true;
mytext.maxChars = 8;

var format1:TextFormat = new TextFormat();
format1.letterSpacing = 2;
format1.font = HelveticaNeue;


mytext.text =  ;
mytext.setTextFormat(format1);

my question is, this code works fine, creates a textfield and I can  
type numbers in that textfield without problems. Only problem is I do  
have a space in the textfield. So when I go ahead and change the line  
to mytext.text = ; now it doesn't have any space at all. but flash  
doesn't allow me to type anything on the text field.


Can someone confirm this for me? Please?

best,
ilteris



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] textfield woes.

2007-08-06 Thread ilteris kaplan
restrict is wrong. you are right. but that didn't really effect it.  
but this truely did.


mytext.setNewTextFormat(format1);

nevertheless, thanks for the link.

On Aug 6, 2007, at 6:39 PM, Palmer, Jim wrote:



Your mytext.restrict is wrong...
should be mytext.restrict = 0-9 ;

read: http://www.adobe.com/support/flash/action_scripts/ 
actionscript_dictionary/actionscript_dictionary762.html


--
Jim Palmer ! Mammoth Web Operations


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of  
ilteris

kaplan
Sent: Monday, August 06, 2007 3:33 PM
To: Flashcoders mailing list
Subject: [Flashcoders] textfield woes.


Hello List,
Very basic question.
Basically I created a new font in my flash library and put this code
in the timeline.

this.createTextField(mytext, this.getNextHighestDepth(), 10, 100,
300, 200);
mytext.multiline = false;

mytext.type = input;
mytext.embedFonts = true;
mytext.restrict = 1,2,3,4,5,6,7,8,9,0;
mytext.border = true;
mytext.maxChars = 8;

var format1:TextFormat = new TextFormat();
format1.letterSpacing = 2;
format1.font = HelveticaNeue;


mytext.text =  ;
mytext.setTextFormat(format1);

my question is, this code works fine, creates a textfield and I can
type numbers in that textfield without problems. Only problem
is I do
have a space in the textfield. So when I go ahead and change
the line
to mytext.text = ; now it doesn't have any space at all. but flash
doesn't allow me to type anything on the text field.

Can someone confirm this for me? Please?

best,
ilteris



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] object Arrays

2007-07-26 Thread ilteris kaplan

Hello All,

Basically I am trying to create a object which I can pass to my array  
and then access some properties of this object. Only problem is, I am  
trying to achieve this in a class.


Basically I declared my array as a class variable and then  
instantiated it in my constructor function in the class. I do have  
this function which is supposedly to create an object with certain  
properties.





private function lizPieceObj(levelup:MovieClip, lizPieceMc:MovieClip,  
masker:MovieClip, levelMasker:MovieClip) {

// build an obj to mimick 2d array.

this.levelup = levelup;
this.lizPieceMC = lizPieceMC;
this.masker = masker;
this.levelMasker = levelMasker;
}


Here is, in another function, I am trying to create this object.
	piecesArray[index] = new lizPieceObj(levelup, lizPieceMc, masker,  
levelMasker);


in order to access them later like
piecesArray[index].levelup, piecesArray[index].masker etc.

But upon compilingthe code, I do get this error. There is no property  
with the name levelup. There is no property with the name lizPiece,  
There is no property with the name masker etc.


you get the idea.
I am assuming this is something to do with scope. I am yet not sure  
how to deal with it though.

Thanks a lot.



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] bitmapData copypixels()

2007-07-25 Thread ilteris kaplan

Hey Flashcoders,

I am creating an empty movieclip and loading an image to it. Then I  
am basically copying this movieclip into a bitmap. The reason I am  
doing this is, in the next step I am slicing up the bitmap into  
different pieces. I think my question is, am I doing an additional  
step first copying the whole movieclip into a whole bitmap? Can I  
just slice it up into pieces of bitmap from its movieclip stage?


A friend of mine mentioned about just slicing it up with draw()  
method instead of copyPixels(). What would you guys recommend?

Thanks in advance.



_root.createEmptyMovieClip(tempMC,1,{_alpha:0});

var theLoader:MovieClipLoader = new MovieClipLoader();
var theListener:Object = new Object();
theLoader.addListener(theListener);

theListener.onLoadInit = function(mc:MovieClip) {
bitmapPic = new BitmapData(_root.tempMC._width, _root.tempMC._height);
bitmapPic.draw(mc,new Matrix());
// draw(bigPicture, null, null, null, new Rectangle(0, 0, 50, 100));
_root.tempMC.removeMovieClip();


for (var i:Number = 0; itotalNumPieces; i++) {
lizPiece = new BitmapData(pieceWidth, pieceHeight);
		lizPiece.copyPixels(bitmapPic,new Rectangle(x, y, pieceWidth,  
pieceHeight),new Point(0, 0));

makeLizPiece(lizPiece,x,y,i);
x += pieceWidth;
if (x=bitmapPic.width) {
x = 0;
y += pieceHeight;
}
}
};

theLoader.loadClip(liz.jpg,_root.tempMC);




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] bitmapData object placing.

2007-07-23 Thread ilteris kaplan

Hello FlashCoders,

I am loading an image into a MC and then copying this into a  
bitmapData object and then creating multiple bitmap objects in order  
to copy various parts of this image. What I am wondering is, in order  
to display  those slices on the screen in different locations I can  
go two different ways. One is, creating those small bitmaps and then  
attaching them into their separate MCs and then setting _x and _y  
properties of those movieclips. The other is, supplying a translated  
matrix argument when drawing this bitmap which would set it again in  
my desired place.


Which way would you recommend me to go in this junction preferably  
CPU wise.


best,
ilteris

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] [as3] colorTransform

2007-04-10 Thread ilteris kaplan

Thanks Petro. It's interesting that if I set the this line
_sprite.graphics.beginFill(0xFF); it doesn't work but if I set it
like  _sprite.graphics.beginFill(0xAABBCC); it works. Does anyone has
any idea why?

On 4/10/07, Petro Bochan [EMAIL PROTECTED] wrote:

ilteris kaplan
 Hello flashcoders,

 Once again, And after this I am not going to bother you for a while,
 I am trying to do basic colorTransform in as3. I am following docs
 from different places and the way I set i up is below: Unfortunately,
 I am missing something here. I would appreciate any advices regarding
 that.

 best,
 ilteris


 package {
   import flash.display.Sprite;
   import flash.events.MouseEvent;
   import flash.events.Event;

   import flash.geom.*;

   public class ColorTransforma extends Sprite
   {


   var _sprite:Sprite;
   var color:ColorTransform;





   public function ColorTransforma() {
   _sprite = new Sprite();

   color = _sprite.transform.colorTransform;
   _sprite.transform.colorTransform = color;

   _sprite.graphics.lineStyle(  );
   _sprite.graphics.beginFill(0xFF);
   _sprite.graphics.drawRect(0, 0, 100, 100);
   _sprite.graphics.endFill(  );
   addChild(_sprite);

   _sprite.addEventListener(MouseEvent.MOUSE_DOWN,
 onMouseDown);


   }

   public function changeColor() {
   color.redOffset = 0;
   color.greenOffset = 0;
   color.blueOffset = 0;
   _sprite.transform.colorTransform = color;

   }

   private function onMouseDown(event:MouseEvent):void {
   changeColor();
   trace(yay);

  }



   }

 }

Hi ilteris,

Not completely sure what you want to do but assuming you want to change
the colour of the sprite upon mouse click you'd have to set the offsets
to something greater than zero. Say you want to change the colour of the
shape to blue, than your code would look something like below (mind the
value of the .blueOffset property):

package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.ColorTransform;

public class ColorTransforma extends Sprite {

var _sprite:Sprite;
var color:ColorTransform;

public function ColorTransforma() {
_sprite = new Sprite();
_sprite.graphics.lineStyle(  );
_sprite.graphics.beginFill(0xAABBCC);
_sprite.graphics.drawRect(0, 0, 100, 100);
_sprite.graphics.endFill(  );
addChild(_sprite);

_sprite.addEventListener(MouseEvent.MOUSE_DOWN,
onMouseDown);
color = _sprite.transform.colorTransform;
_sprite.transform.colorTransform = color;
}

public function changeColor() {
color.redOffset = 0;
color.greenOffset = 0;
color.blueOffset = 255;
_sprite.transform.colorTransform = color;
}

private function onMouseDown(event:MouseEvent):void {
changeColor();
trace(yay);

 }

}

}

Cheers,
Petro

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3]setting kerning of a dynamic text

2007-04-10 Thread ilteris kaplan

Hello Everyone,

For those missed my previous fonts, I could able to load some font
symbols from an flash 8 swf by the help of [Embed(source='din.swf',
symbol='dinBold' )] etc.

Now what I am wondering if there is anyway to set the kerning of the
dynamic font we are using in flash? I remember there wasn't such a way
to do it previous versions of flash, is it still the case?

best,
ilteris
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Re: [as3]setting kerning of a dynamic text

2007-04-10 Thread ilteris kaplan
Ok I have found out that I need to use textformat.letterSpacing  
property.


But I am still confused how to load multiple typefaces into my project.
Here is how I am doing it:


[Embed(source='din.swf', fontName='akzidenzBold' ,  
mimeType='application/x-font')]





public class Loadfont extends Sprite {

//[Embed(source='font.swf', symbol='akzidenzBold' )]


private var _timer:Timer;
private var tf:TextField;

public function Loadfont() {
tf = new TextField();
test();

listFonts();

 _timer = new Timer(1);
_timer.addEventListener(timer, onTimer);
_timer.start(  );
}

public function test():void {
var defaultTextFormat:TextFormat = new TextFormat();
tf.embedFonts = true;
defaultTextFormat.font = Akzidenz BE Bold;
tf.antiAliasType = AntiAliasType.ADVANCED;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = false;
tf.text = blah blah blah\nblah blah blah\nblah blah blah 
;

defaultTextFormat.letterSpacing = -3;
tf.setTextFormat(defaultTextFormat);
//  tf.rotation += 2;
addChild(tf);
}



This basically doesn't work.  Can someone help me figure out why?
best,
ilteris


On Apr 10, 2007, at 1:38 PM, ilteris kaplan wrote:


Hello Everyone,

For those missed my previous fonts, I could able to load some font
symbols from an flash 8 swf by the help of [Embed(source='din.swf',
symbol='dinBold' )] etc.

Now what I am wondering if there is anyway to set the kerning of the
dynamic font we are using in flash? I remember there wasn't such a way
to do it previous versions of flash, is it still the case?

best,
ilteris


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] [as3] mouseEvents are not triggering

2007-04-09 Thread ilteris kaplan

Thanks Atila,

I am totally new to programming in as3 and I am trying to make sense :)
I though it would be a good idea to keep the mouseEvents on the main
class file along with everything but as you said I moved it from there
to particleManager and it solved my problem.  thanks.



On 4/9/07, Rákos Attila [EMAIL PROTECTED] wrote:


You didn't add _sprite to the display list, so how could it trigger mouse
events if it is not even visible? And on the other hand, _sprite is
totally empty, it has no hit area where you can click and fire the
MOUSE_DOWN event. Why don't you add event listener to the particle
manager? Sorry if I miss something, but I don't understand exactly what
are you going to do.

  Attila

 Hello All,

 I am having a difficulty using mouseEvents in AS3.0 with Flex
 Builder. When I test a basic example it works fine but my setup is
 different. It is  like this: I do have some circles which is
 controlled by particleManager class. Basically Iam adding
 particleManager with addChild method in order to render it on the
 stage. Next I created _sprite in order to call mouseEvents on top of
 it.  And in the below code, I didn't do anything different, I just
 added Listeners for mouseEvents.  Do I have to do something special
 with pm object?  Should I be instantiating mouse Events on top of pm
 object? Am I supposed to register pm objects with mouseEvents so that
 they can be triggered? If so what's the right way to do it?

 I really appreciate any help.
 best,
 ilteris


 /**
 * saturday april 7.
   * first iteration.
 */
 package {
   import flash.display.Sprite;
   import flash.events.Event;
  import flash.events.TimerEvent;
  import flash.utils.Timer;
  import flash.events.MouseEvent;

   [SWF(backgroundColor=#1C1A14, width=400, height=180,
 frameRate=61)]


   public class Moodbox2 extends Sprite {
   private var _timer:Timer;
   public var pm:ParticleManager;
   private var _sprite:Sprite;
   public function Moodbox2() {
pm = new ParticleManager();
   _sprite = new Sprite();
   addChild(pm);


   _sprite.addEventListener(MouseEvent.MOUSE_DOWN, 
onMouseDown);
   _sprite.addEventListener(MouseEvent.MOUSE_UP, 
onMouseUp);


   _timer = new Timer(3);
  _timer.addEventListener(timer, onTimer);
  _timer.start(  );


   }

public function onTimer(event:TimerEvent):void {
 pm.idle(0.4);
   pm.draw();
  //  addChild(pm);
  }

   private function onMouseDown(event:MouseEvent):void {
   trace(pm.PRTS[0].pos.x);
//  pm.PRTS[0].pos.setN(mouseX,mouseY);
_sprite.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
  }

private function onMouseUp(event:MouseEvent):void {
  _sprite.removeEventListener(MouseEvent.MOUSE_MOVE,
 onMouseMove);
}


private function onMouseMove(event:MouseEvent):void {
  trace(yes);
}


   }
 }

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3] using stage.stageWidth property in a constructor

2007-04-09 Thread ilteris kaplan

Hello Flash Folks,

I am trying to access stage.stageWidth property in order to be able  
to give certain x,y values to my objects when they are created. So  
when I went ahead tried to use stage.stageWidth by just tracing like  
trace(stage.stageWidth);

this causing flash player 9 to throw an error to me:

TypeError: Error #1009: Cannot access a property or method of a null  
object reference.

at ParticleManager$iinit()
at Moodbox2$iinit()

so what I am guessing is stage object is not instantiated when I am  
trying to call it. Anyone know any workaround for this?


best,
ilteris
 
  
___

Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3] embedded fonts from external swfs.

2007-04-09 Thread ilteris kaplan

Hello Flashcoders,

I am working on a project where I need to embed multiple typefaces in  
my AS3 project. Here is what I got so far. I could happened to open  
my flash 8 and create multiple font symbols and add a linkage and  
check them to export them for actionscript. Then I put that file in  
my AS3 project where I am developing using Flex Builder 2.


Then I just hacked an existing example with mashing flex2 examples on  
adobe labs. My file name for flash 8 swf is  din.swf and I went  
ahead and added this line in the beginning of my project:


[Embed(source='din.swf', symbol='dinBold' )]

this worked perfectly!  So the symbol 'dinBold' was its linkage name  
when I was exporting it form flash 8.  so far so good, but my problem  
is how could I use this to import multiple typefaces?


When I go  to extract multiple symbols from the same swf it simply  
doesn't work.  I have been following this from the flex docs at the  
adobe lab so I couldn't understand why this is not working.


[Embed(source='din.swf', symbol='dinBold' )]// linkage name dinBold

[Embed(source='din.swf', symbol='dinLight' )] // linkage name dinLight

I can create a unique swf for each of the typeface but then this is  
really cumbersome and I think there should be a way to import  
multiple symbols from the same swf.


Thanks in advance.
ilteris


here is my source code just in case:


package {
import flash.display.Sprite;
import flash.text.*;

import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;

 [SWF(backgroundColor=#1C1A14,  frameRate=61)]

 [Embed(source='din.swf', symbol='dinBold' )]
public class Loadfont extends Sprite {

private var _timer:Timer;
private var tf:TextField;

public function Loadfont() {
tf = new TextField();
test();

listFonts();

 _timer = new Timer(1);
_timer.addEventListener(timer, onTimer);
_timer.start(  );
}

public function test():void {
tf.defaultTextFormat = new 
TextFormat(DIN-BoldAlternate, 50, 255);
tf.embedFonts = true;
tf.antiAliasType = AntiAliasType.ADVANCED;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = false;
tf.text = blah blah blah\nblah blah blah\nblah blah blah 
;
tf.rotation += 2;
addChild(tf);
}

public function listFonts() {   
var fontList:Array = Font.enumerateFonts(false);
for (var i:uint=0; ifontList.length; i++) {
trace(font: +fontList[i].fontName);
}
}

public function onTimer(event:TimerEvent):void {
 tf.rotation += 2;
   // trace(this.stage.stageHeight);
}


}
}


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3] colorTransform

2007-04-09 Thread ilteris kaplan

Hello flashcoders,

Once again, And after this I am not going to bother you for a while,  
I am trying to do basic colorTransform in as3. I am following docs  
from different places and the way I set i up is below: Unfortunately,  
I am missing something here. I would appreciate any advices regarding  
that.


best,
ilteris


package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;

import flash.geom.*;

public class ColorTransforma extends Sprite
{


var _sprite:Sprite; 
var color:ColorTransform;





public function ColorTransforma() {
_sprite = new Sprite();

color = _sprite.transform.colorTransform;
_sprite.transform.colorTransform = color;

_sprite.graphics.lineStyle(  );
_sprite.graphics.beginFill(0xFF);
_sprite.graphics.drawRect(0, 0, 100, 100);
_sprite.graphics.endFill(  );
addChild(_sprite);

_sprite.addEventListener(MouseEvent.MOUSE_DOWN, 
onMouseDown);


}

public function changeColor() {
color.redOffset = 0;
color.greenOffset = 0;
color.blueOffset = 0;
_sprite.transform.colorTransform = color;

}

private function onMouseDown(event:MouseEvent):void {
changeColor();
trace(yay);

}



}

}



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3] mouseEvents are not triggering

2007-04-08 Thread ilteris kaplan

Hello All,

I am having a difficulty using mouseEvents in AS3.0 with Flex  
Builder. When I test a basic example it works fine but my setup is  
different. It is  like this: I do have some circles which is  
controlled by particleManager class. Basically Iam adding  
particleManager with addChild method in order to render it on the  
stage. Next I created _sprite in order to call mouseEvents on top of  
it.  And in the below code, I didn't do anything different, I just  
added Listeners for mouseEvents.  Do I have to do something special  
with pm object?  Should I be instantiating mouse Events on top of pm  
object? Am I supposed to register pm objects with mouseEvents so that  
they can be triggered? If so what's the right way to do it?


I really appreciate any help.
best,
ilteris


/**
* saturday april 7.
 * first iteration.
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.events.MouseEvent;

 [SWF(backgroundColor=#1C1A14, width=400, height=180,  
frameRate=61)]



public class Moodbox2 extends Sprite {
private var _timer:Timer;
public var pm:ParticleManager;
private var _sprite:Sprite;
public function Moodbox2() {
 pm = new ParticleManager();
_sprite = new Sprite();
addChild(pm);


_sprite.addEventListener(MouseEvent.MOUSE_DOWN, 
onMouseDown);
_sprite.addEventListener(MouseEvent.MOUSE_UP, 
onMouseUp);


_timer = new Timer(3);
_timer.addEventListener(timer, onTimer);
_timer.start(  );


}

 public function onTimer(event:TimerEvent):void {
  pm.idle(0.4);
 pm.draw();
//  addChild(pm);
}

 private function onMouseDown(event:MouseEvent):void {
trace(pm.PRTS[0].pos.x);
  //  pm.PRTS[0].pos.setN(mouseX,mouseY);
  _sprite.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}

  private function onMouseUp(event:MouseEvent):void {
_sprite.removeEventListener(MouseEvent.MOUSE_MOVE,  
onMouseMove);

  }


  private function onMouseMove(event:MouseEvent):void {
trace(yes);
  }


}
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] [as3] addchild()

2007-04-07 Thread ilteris kaplan

Hello Dear Flashcoders,

I am trying to create a particle system in AS3 in flex builder 2.

so my structure is like this: I do have a main class of the program,  
I do have Circle class and I do have CircleManager class which  
handles all initialization and declarations about circle objects.


What I am having difficulty is the rendering process.

Before adding this CircleManager class, the way I created Circle  
class was to extend Shape class and use it according to my needs and  
then in the main class I could able to add it like;


// main class
var c:Circle = new Circle();
c.draw();
addchild(c);



but since I added my CircleManager class and even I did the changes I  
was supposed to do, I think I am still missing something since I  
don't see anything on the screen.  What I did was I create a  
CircleManager class and move all declarations of circle to here. for  
my main I changed it like below:


// main class
var c:CircleManager = new CircleManager();
c.draw();
addchild(c);


This first gave me error and it made sense. I forgot to extend my  
CircleManager class with sprite or shape in order to be able to use  
it with addChild. So I went ahead and added extend Shape to my  
CircleManager class. It corrected the error but when I ran this I  
don't see anything on the screen. When I debug the code I can trace  
the x,y values for Circles. So my questions:


Should I still be adding all the circle objects with addchild()  
method in order to render them on the screen? Isn't there a way to  
just add my CircleManager and let it do the job? Should I make Circle  
subclass of CircleManager in order to do it?  I am looking forward to  
your advices.


best,
ilteris


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] timeline function call from inside of a class

2006-08-16 Thread ilteris kaplan

Hi List,

I am trying to call a function I have created on the timeline of some  
movieclip from inside of a class I have created. It looks like I  
cannot do that, as it is giving me undefined when I trace the  
function. Is this doable in AS2.0 or not? Is there workaround I  
should follow and please enlighten me if I am missing something!


as a code example:

in my _root.main :
function foo() {
trace(foo);
}

and in my class I am trying to access this function by;
_root.main.foo();

***
is this doable?



thanks in advance
ilteris kaplan

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] timeline function call from inside of a class

2006-08-16 Thread ilteris kaplan

yep, it looks like it exists,  my problem is somewhere else probably.

thanks!!


On Aug 16, at 6:58 PM, Daniel Too wrote:

This is definitely doable.  when you run _root.main.foo() does  
_root.main exist?


ilteris kaplan wrote:

Hi List,

I am trying to call a function I have created on the timeline of  
some movieclip from inside of a class I have created. It looks  
like I cannot do that, as it is giving me undefined when I trace  
the function. Is this doable in AS2.0 or not? Is there workaround  
I should follow and please enlighten me if I am missing something!


as a code example:

in my _root.main :
function foo() {
trace(foo);
}

and in my class I am trying to access this function by;
_root.main.foo();

***
is this doable?



thanks in advance
ilteris kaplan

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] private property doesn't get called?

2006-08-14 Thread ilteris kaplan

Hello I am having a really strange problem here.

I have a boolean property in my class and I am trying to set its  
value to true as it should be, but it looks like it didn't get even  
instantiated in the class. Briefly in my class first sendVar method  
gets call from outside and pass two Number value to two properties  
(_current, _previous).
According to those values I do instantiate openCanvas() method from  
outside which calls a delegated function canvasOpenFinished(). So it  
triggers openSection() and with the help of closeButton function  
(which is also delegated from onPress() inside of canvasOpenFinished 
()) I trigger closeSection() method and then things get funky here. I  
call an outside function which after done triggers closeCanvas() in  
this class. And closeCanvas() triggers canvasClosedFinished() method  
and this is where I check if my  property(this.flag) is true or  
false. Only the trace tells me it is undefined!


What is it I am missing here? I am looking for your advices!!
ilteris.

Here is my class:

import mx.transitions.Tween;
class Canvas {
private var tween1:Tween;
private var tween2:Tween;
public var mc:MovieClip;
public var closeBtn:MovieClip;
private var _level:Number;
private var flag:Boolean; // this is the property I am talking about
public var _current:Number;
public var _previous:Number;


// Constructor
public function Canvas(timeline:MovieClip, level:Number, y_:Number) {
		mc = timeline.attachMovie(canvas, kanvas, level, {_x:158,  
_y:y_, _width:0});

mc.obj = this; //
_level = level;
}
public function openCanvas() {
		tween1 = new Tween(mc, _width,  
mx.transitions.easing.Strong.easeOut, 0, 673, 1, true);
		tween1.onMotionFinished = mx.utils.Delegate.create(this,  
canvasOpenFinished);

}
public function closeCanvas() {
		tween2 = new Tween(mc, _width,  
mx.transitions.easing.Strong.easeOut, 673, 0, 1, true);
		tween2.onMotionFinished = mx.utils.Delegate.create(this,  
canvasCloseFinished);

}
public function canvasOpenFinished() {
trace(canvas is open);
// we add our button on the right up corner.
		closeBtn = this.mc.attachMovie(closebtn, _closeBtn, _level+1,  
{_x:657, _y:4});

//closebutton is a method to call when we want to close the 
section
// and the canvas without opening new one.
closeBtn.onPress = mx.utils.Delegate.create(this, closeButton);
// check if there is already an opened section here
if (_previous == null) {
openSection();
} else {
// method to close an already opened link and canvas 
here!
}
}
public function canvasCloseFinished() {
// trace(current:  + this._current);
// trace(previous:  + this._previous);
if (!this.flag) {
this.openCanvas();
} else {
_root.main.prevMovie.gotoAndStop(1);
_root.main.prevMovie.teks.textColor = 0xff;
}
}
public function openSection() {
_root.main[container+_current]._visible = true;
_root.main[container+_current].main.startAnimation();
}
public function closeSection() {
// if(_previous != _current) {
// trigger closeCanvas inside of loaded swf's method 
finishAnimation!
// I must find a better way of doing this.
_root.main[container+_current].main.finishAnimation();
// else {
//_root.main[container+ _previous].main.finishAnimation();
// }
}
public function closeButton() {
trace(flag:  + this.flag);  // undefined
 this.flag = true;
// call closesection function
// which will call finishAnimation() of a loaded mc!
closeSection();
this.mc._closeBtn.removeMovieClip();
_root.main.prev = null;
}
public function sendVar(cur_:Number, prev_:Number) {
_current = cur_;
_previous = prev_;
}
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] delegate and proxy

2006-08-14 Thread ilteris kaplan

Hello List,
I am trying to pass a parameter to my function with the help of  
delegate or proxy but I couldn't succeed in both :(


I have read http://www.person13.com/articles/proxy/Proxy.htm but  
still couldn't quite figure out how I should do it. Honestly I begin  
to feel like dumb four in the morning.


please let me know what I am missing here!!

best,
ilteris.


import ascb.util.Proxy;

function finishAnimation(_mc:MovieClip) { // mc is my movieclip I am  
passing inside of this function

// I am trying to pass _mc as a parameter to endOfMotion() method
	var tween4 = new Tween(image, _alpha,  
mx.transitions.easing.Regular.easeOut, 100, 0, 3, true);
	tween4.onMotionFinished = ascb.util.Proxy.create(this, endOfMotion,  
_mc);

}

function endOfMotion(_mc:MovieClip) {
// this.obj.canv.closeCanvas();
trace(_mc); // when I trace it, it still gives me [Tween]

}


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] delegating inside a tween class

2006-08-13 Thread ilteris kaplan

Dear List,
I am trying to use tween's onMotionFinished method in order to make  
use of this, only when I try to call it normally (see closeCanvas  
method below) and trace(mc) it traces undefined. So when I tried to  
delegate onMotionFinished, I stumbled accross another problem. This  
time since tween1 is instantiated insideof the openCanvas method,  
delegating it in the constructor doesn't help at all.


So what  should I do to workaround this? Basically I am trying to  
trigger an event when the motionFinished.
IS using tween inside classes is a bad habit, should I take the code  
to the timeline? I really appreciate advices and helps!!



best,
ilteris.


import mx.transitions.Tween;
class Canvas {
private var tween1:Tween;
private var tween2:Tween;
public var mc:MovieClip;
// Constructor
public function Canvas(timeline:MovieClip, level:Number, y_:Number) {
		mc = timeline.attachMovie(canvas, canvasS, level, {_x:158,  
_y:y_, _width:0});
		this.tween1.onMotionFinished = mx.utils.Delegate.create(this,  
this.mcMotionFinished);

}
public function openCanvas() {
		tween1 = new Tween(mc, _width,  
mx.transitions.easing.Strong.easeOut, 0, 673, 3, true);

mcMotionFinished(); // this doesn't scope to the class  
}

public function mcMotionFinished() {
trace(this); // I am assuming this should scope to
// the class only I am not able 
to call this method.
}

public function closeCanvas() {
		tween2 = new Tween(mc, _width,  
mx.transitions.easing.Strong.easeOut, 673, 0, 2, true);

tween2.onMotionFinished = function() {
trace(mc) // nope, this scope to the tween itself.
// check which one is pressed for next!
}
}
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] delegating inside a tween class

2006-08-13 Thread ilteris kaplan

Helen,
you just saved my day! I wish you were here and I bought you a brunch!!

best,
ilteris.

On Aug 13, at 8:15 AM, Helen Triolo wrote:


ilteris,

You can't assign a function to the onMotionFinished property (in  
the constructor) before the Tween instance has been created (in  
openCanvas).  Those should be more like:


 public function Canvas(timeline:MovieClip, level:Number, y_:Number) {
   mc = timeline.attachMovie(canvas, canvasS, level, {_x: 
158,  _y:y_, _width:0});

   }
   public function openCanvas() {
   tween1 = new Tween(mc, _width,   
mx.transitions.easing.Strong.easeOut, 0, 673, 3, true);
   tween1.onMotionFinished = mx.utils.Delegate.create(this,   
mcMotionFinished);

   }

Helen

ilteris kaplan wrote:


Dear List,
I am trying to use tween's onMotionFinished method in order to  
make  use of this, only when I try to call it normally (see  
closeCanvas  method below) and trace(mc) it traces undefined. So  
when I tried to  delegate onMotionFinished, I stumbled accross  
another problem. This  time since tween1 is instantiated insideof  
the openCanvas method,  delegating it in the constructor doesn't  
help at all.


So what  should I do to workaround this? Basically I am trying to   
trigger an event when the motionFinished.
IS using tween inside classes is a bad habit, should I take the  
code  to the timeline? I really appreciate advices and helps!!



best,
ilteris.


import mx.transitions.Tween;
class Canvas {
private var tween1:Tween;
private var tween2:Tween;
public var mc:MovieClip;
// Constructor
public function Canvas(timeline:MovieClip, level:Number,  
y_:Number) {
mc = timeline.attachMovie(canvas, canvasS, level, {_x: 
158,  _y:y_, _width:0});
this.tween1.onMotionFinished = mx.utils.Delegate.create 
(this,  this.mcMotionFinished);

}
public function openCanvas() {
tween1 = new Tween(mc, _width,   
mx.transitions.easing.Strong.easeOut, 0, 673, 3, true);
mcMotionFinished(); // this doesn't scope to the  
class   }


public function mcMotionFinished() {
trace(this); // I am assuming this should scope to
// the class only I am not able to call  
this method.

}

public function closeCanvas() {
tween2 = new Tween(mc, _width,   
mx.transitions.easing.Strong.easeOut, 673, 0, 2, true);

tween2.onMotionFinished = function() {
trace(mc) // nope, this scope to the tween itself.
// check which one is pressed for next!
}
}
}



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com