RE: [Flashcoders] Random Error

2007-05-02 Thread Petro Bochan
Hi,

Which version of Flash are you using? I tried this on Flash CS3 and it
worked out seamlessly.

package {

import flash.display.Sprite;
import flash.system.Capabilities;

public class Test extends Sprite {
public function Test() {
}

public static function getInfo() {
return(Capabilities.version);
}
}
}

.fla
trace(Test.getInfo());

Cheers,
Petro

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Dave Mennenoh
> Sent: Friday, April 27, 2007 6:13 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Random Error
> 
> Once in a while, when compiling, I get an error from one of my
classes. The
> error is something like: 'property System not found', and it is thrown
from
> this function:
> 
> public static function getPlayerVersion()
> {
>   return(System.capabilities.version);
>  }
> 
> 
> I only see the error once out of 20 compiles or so... thoughts?
> 
> 
> Dave -
> Head Developer
> http://www.blurredistinction.com
> Adobe Community Expert
> http://www.adobe.com/communities/experts/
> 
> ___
> 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


RE: [Flashcoders] as3 addchild question

2007-04-27 Thread Petro Bochan
Hi,

Not sure what you are after, but you might try something like this:

import flash.display.*;

var lista:Array = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);

for (i = 0; i < lista.length; i++) {
var vSprite:Sprite = new Sprite();
vSprite.graphics.lineStyle();
vSprite.graphics.beginFill(0xAABBCC);
vSprite.graphics.drawRect(10, 10, 10, 10);
vSprite.graphics.endFill();
vSprite.x = lista[i] * 30;
addChild(vSprite);
}

Hope that helps,
Petro

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Gustavo Duenas
> Sent: Thursday, April 26, 2007 7:11 PM
> To: Flashcoders mailing list
> Subject: [Flashcoders] as3 addchild question
> 
> Hi Guys, I've just read that in AS3 there is no more
> createEmptyMovieClip  or attachMovie so there is addChild, but the
> problem is when I use a loop to said this add child to load
> a linkage movie several times, it doesn't appear in the screen but
> one. here is the code I'm using in the flash 9 alpha.
> 
> 
> 
>   import flash.display.*;
> 
> 
> 
> 
> 
> 
> var lista:Array = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
> 
> trace (lista);
> 
> for(i=0; i 
> trace(lista[i]);
> trace(newMovie + newMovieX);
> var newMovie = this.addChild(new movie1());
> var newMovieX= newMovie.x+lista[i]*30;
> }
> 
> whe I do the trace the screen show several objects but I don't know
> how to give them a different values for x.
> I can do this in as2, but I'd rather do this in as3, since I'm
> practicing with this now.
> 
> any ideas?
> I need help.
> 
> 
> regards
> 
> Gustavo Duenas
> 
> ___
> 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] Flash 9 Alpha Preview TextInput Weirdness

2007-04-20 Thread Petro Bochan
Hi,

Though it's way too late to post this kind of message since Flash CS3 is
pretty much out but anyways. Try to initialize this chunk of code in the
alpha preview:

package {

import flash.display.Sprite;
import mx.controls.TextInput;

public class Test extends Sprite {

public function Test() {
var vTextInput:TextInput = new TextInput();
}
}
}

You'll likely get this:

**Error** D:\{path}\Test.as : Line 9, Column 19 : [Compiler] Error
#1046: Type was not found or was not a compile-time constant: TextInput.
var vTextInput:TextInput = new TextInput();
**Error** D:\{path}\Test.as : Line 9, Column 35 : [Compiler] Error
#1180: Call to a possibly undefined method TextInput.
var vTextInput:TextInput = new TextInput();
**Error** D:\{path}\Test.as : Line 4, Column 21 : [Compiler] Error
#1172: Definition mx.controls:TextInput could not be found.
import mx.controls.TextInput;
ReferenceError: Error #1065: Variable
Timeline0_d5d529a7787d74f90f259f8632b8b7 is not defined.

Flex 2 compiles this with no troubles. It turns out that for some
unknown reason the alpha release can't read the mx.controls.* package.

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


RE: [Flashcoders] [as3] colorTransform

2007-04-10 Thread Petro Bochan
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?

Hi ilteris,

Hmm, this looks fairly weird, though there is a workaround: if by chance
you set the fill of a Sprite to be 0xFF (totally white) and want to
apply a new colour, instead of playing with offsets and multipliers, use
the .color property. Something like this:

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(1, 0xFF);
_sprite.graphics.beginFill(0xFF);
_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.color = 0xAABBCC;
_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


RE: [Flashcoders] [as3] colorTransform

2007-04-10 Thread Petro Bochan
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


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Petro Bochan
Hi,

Do additional addChild(hw) in your .fla file. Also, the
DisplayObjectContainer isn't needed.

Cheers,
Petro

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Merrill, Jason
> Sent: Thursday, March 22, 2007 3:09 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
> 
> Getting my feet wet with AS3, I just bought the AS3 cookbook and have
> learned a lot already - great book.  I feel like an idiot asking this
as
> I'm pretty good in AS2, but with AS3, I'm not getting a simple script
> working. I have the Flash 9 AS3 preview, trying to write a simple
> HelloWorld class (based on an example in the book) to show a
TextField:
> 
> //MyPackage.as
> package MyPackage
> {
>   //do I actually need this one?:
>   import flash.display.DisplayObjectContainer;
> 
>   import flash.display.Sprite;
>   import flash.text.TextField;
> 
>   public class HelloWorld extends Sprite
>   {
>   public function HelloWorld()
>   {
>   var message_txt:TextField = new TextField();
>   message_txt.text = "Hello World";
>   addChild(message_txt);  //does not show!
>   trace("constructor runs")//traces fine
>   }
>   }
> }
> 
> Then in the .fla, I put:
> 
> import MyPackage.*
> var hw:HelloWorld = new HelloWorld();
> 
> The constructor traces fine in the output window, but the TextField
does
> not show.  What have I done wrong?  My Export settings in F9 As3
preview
> are for AS 3.0 and FP9.  In later scripts, I tried moving the
textfield,
> changing the color, changing the stage color to be sure it wasn't
> matching the textfield and this invisible, etc...(but it should show
as
> black Times New Roman text by default anyway...)
> 
> Thanks,
> 
> Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax
set
> to AS3, but have notices code hinting doesn't always work or is
> sometimes incomplete - has anyone else noticed that?  Maybe I just
need
> to update it.
> 
> Jason Merrill
> Bank of America
> GT&O Learning & Leadership Development
> eTools & Multimedia Team
> 
> 
> 
> ___
> 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


RE: [Flashcoders] File upload in flash

2007-01-30 Thread Petro Bochan
Claudio M. E. Bastos Iorio
> Hi guys, I hope you can help me on this.
> I need to add an "upload file" control inside a flash form, like the
one
> in
> html. I'm working with php and MySql in the backend. But I don't
really
> know
> how to add such a feature in flash.  Any help/links examples will be
much
> appreciated.

Hi Claudio,

Check out the Loader class @
http://livedocs.macromedia.com/flex/2/langref/index.html, this will give
all the info that you need.

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


RE: [Flashcoders] AS3 properties woes

2007-01-24 Thread Petro Bochan
Brandon Barkley
> Also not an AS3 expert, but I think Danny is wrong. The super function
> is necessary to call the parent constructor.

Hi Brandon,

I'm afraid u r wrong. Just try it out, the constructor IS being called
once u extend the class.

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


RE: [Flashcoders] AS3 properties woes

2007-01-24 Thread Petro Bochan
Keith Salisbury
> 
> Slightly confused
> 
> I have a super class:
> 
> package com.ktec.timeline
> {
>   protected var labelClass:String = "default";
>   public class AbstractMarker {
> public function AbstractMarker ()
> {
>   labelClass = "default";
> }
> public function showTitle (title:String):void
> {
>   trace(" + title + "")
> }
>   }
> }
> 
> and a subclass:
> 
> package com.ktec.timeline
> {
>   public class DateMarker extends AbstractMarker
>   {
> public function DateMarker ()
> {
>   super();
>   labelClass = "date"
> }
>   }
> }
> 
> 
> Then i use:
> 
> var marker:DateMarker = new DateMarker()
> 
> marker.showTitle("hello world") # hello
world
> 
> 
> This isnt what i would expect?
> 
> Can anyone enlighten me where i'm going wrong?
> 
> thanks
> keith

Hi Keith,

Little question: what r u working under: Flash 9 Beta or Flex 2? I
wonder your code even compiled. Move this line:

protected var labelClass:String = "default";

inside your class definition. It's outside the scope of the class. I
tried it out, worked fine for me.

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


RE: [Flashcoders] AS3.0 - add separate objects to stage

2006-12-20 Thread Petro Bochan
Simon
> In your script below you add 2 bitmaps to a Sprite and want to use
mouse
> stuff on the bitmap, I guess that that won't work because they are not
of
> type interactiveObject I guess that creating a sprite, add the
bitmap
> to
> the sprite, add the listeners to the sprite, and add the sprite to the
> displaylist of your class(sprite)should work.

Hi Simon,

Worked out seamlessly, thanks a lot!

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


RE: [Flashcoders] AS3.0 - add separate objects to stage

2006-12-20 Thread Petro Bochan
James Tann
> Are you sure about this? I have been using bitmaps extensively in the
> project im working on and have had no issues like this. What is the
> structure of children like?
> 
> Sprite ->
>-> Bitmap
>-> Bitmap
> 
> I would have to see some code to help out.
> Jim

Hi James,

This is not the pure example code from the project but this kind of
resembles the idea.


package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.BitmapData;

public class addChildIssue extends Sprite
{
public function addChildIssue()
{
var timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER,
onTimer);
timer.start();
var uploader:Loader = new Loader();
var url:URLRequest = new URLRequest();
url.url =
"http://www.venturaes.com/macromedia/images/studio8_box.jpg";;

uploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onResult);

uploader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
onFault);
uploader.load(url);
}

private function onResult(anEvent:Event):void
{
var bitmap:Bitmap =
Bitmap(anEvent.target.content);
bitmap.addEventListener(MouseEvent.MOUSE_DOWN,
onDrag);
bitmap.addEventListener(MouseEvent.MOUSE_UP,
onDrop);
addChild(bitmap);
}

private function onFault(anEvent:Event):void
{

}

private function onDrag(anEvent:MouseEvent):void
{
anEvent.target.startDrag();
}

private function onDrop(anEvent:MouseEvent):void
{
anEvent.target.stopDrag();
}

private function onTimer(anEvent:TimerEvent):void
{
var uploader:Loader = new Loader();
var url:URLRequest = new URLRequest();
url.url =
"http://wwwimages.adobe.com/www.adobe.com/products/audition/images/audit
ion_flash.jpg";

uploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onResult);

uploader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
onFault);
uploader.load(url);
}

}
}
--

Copy and past it into Flex, should work. I even now face the problem of
not being able to move any image at all. This works fine with shapes,
but bitmaps fail.

Thanks,
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] AS3.0 - add separate objects to stage

2006-12-20 Thread Petro Bochan
Hi,

Whenever I issue a command "addChild(bitmap)" the new image is being
merged with the existing one. How do I make sure the new image is added
as a separate display object? This is true for both, bitmap & shape
data.

I think this has something to do with the BitmapData class.

Thanks,
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