Re: [Flashcoders] Delegate question...

2008-02-02 Thread EECOLOR
class fly.Delegate extends Object
{
   static function create(obj:Object, func:Function):Function
   {
  var returnFunction = function()
  {
 var self:Function = arguments.callee;
 var target_obj:Object = self.target_obj;
 var func:Function = self.func;
 var userArguments_array:Array = self.userArguments_array;
 return func.apply(target_obj, arguments.concat
(userArguments_array));
  };

  returnFunction.target_obj = obj;
  returnFunction.func = func;
  returnFunction.userArguments_array = arguments.splice(2);
  return returnFunction;
   }
};



Greetz Erik


On 2/2/08, Muzak [EMAIL PROTECTED] wrote:

 You don't and should never have to.
 Create a custom button (MovieClip+Class) that dispatches an event (e.g.
 release), rather than using a generic Button/MovieClip
 symbol.
 So instead of:

 someMC.onRelease = Delegate.create(_level0, doSomething);

 you'd then use:

 function doSomething(o:Object):Void {
 trace(o.target);
 }
 someMC.addEventListener(release, Delegate.create(this,
 doSomething));

 regards,
 Muzak

 - Original Message -
 From: [p e r c e p t i c o n] [EMAIL PROTECTED]
 To: Flash Coders List flashcoders@chattyfig.figleaf.com
 Sent: Saturday, February 02, 2008 1:02 AM
 Subject: [Flashcoders] Delegate question...


  Howdy,
  Quick question...How can I pass vars if i'm using delegates for
 handlers
  I have it set up like so...
 
 
  someMC.onRelease = Delegate.create(_level0, doSomething);
 
  what i want to be able to do is know which instance of someMC actually
  called it...
 
  thanks
 
  p

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] LoadVars and SQL Query issue

2008-02-02 Thread Pete Hotchkiss
Omar

This is the least of your worries  google SQL injection attacks before you 
waste too much more development time trying to resolve this issue.

Pete


-Original Message-
From: [EMAIL PROTECTED] on behalf of Omar Fouad
Sent: Sat 2/2/2008 1:07 AM
To: Flash Coders List
Subject: [Flashcoders] LoadVars and SQL Query issue
 
I am doing an application where I'm writing some classes that sends queries
to a php file by using LoadVars.send().

var toSend:LoadVars = new LoadVars();
var myQuery:String = select * from users where Name = 'Omar Fouad' ;
toSend.query = myQuery; // tracesselect * from users where Name = 'Omar
Fouad'
toSend.send(File.php, _self, POST);

At this phase the php files receive the query and when I echo the query
string appears:

select * from users where Name = \'Omar Fouad\'
That's is how it is sent to the server so of course it shows an SQL error
because of the backslashes. Apparently it does not recognize the String in
the String part of the query that is sent from Flash.

When I send a query for a Number like:

select ^ from users where id = 1

it queries the database without problems.

How can I solve this problem?

Thanks and Regards.

-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Delegate question...

2008-02-02 Thread [p e r c e p t i c o n]
you guys are indeed the best

many thanks
p

On Feb 2, 2008 5:28 AM, EECOLOR [EMAIL PROTECTED] wrote:

 class fly.Delegate extends Object
 {
   static function create(obj:Object, func:Function):Function
   {
  var returnFunction = function()
  {
 var self:Function = arguments.callee;
 var target_obj:Object = self.target_obj;
 var func:Function = self.func;
 var userArguments_array:Array = self.userArguments_array;
 return func.apply(target_obj, arguments.concat
 (userArguments_array));
  };

  returnFunction.target_obj = obj;
  returnFunction.func = func;
  returnFunction.userArguments_array = arguments.splice(2);
  return returnFunction;
   }
 };



 Greetz Erik


 On 2/2/08, Muzak [EMAIL PROTECTED] wrote:
 
  You don't and should never have to.
  Create a custom button (MovieClip+Class) that dispatches an event (e.g.
  release), rather than using a generic Button/MovieClip
  symbol.
  So instead of:
 
  someMC.onRelease = Delegate.create(_level0, doSomething);
 
  you'd then use:
 
  function doSomething(o:Object):Void {
  trace(o.target);
  }
  someMC.addEventListener(release, Delegate.create(this,
  doSomething));
 
  regards,
  Muzak
 
  - Original Message -
  From: [p e r c e p t i c o n] [EMAIL PROTECTED]
  To: Flash Coders List flashcoders@chattyfig.figleaf.com
  Sent: Saturday, February 02, 2008 1:02 AM
  Subject: [Flashcoders] Delegate question...
 
 
   Howdy,
   Quick question...How can I pass vars if i'm using delegates for
  handlers
   I have it set up like so...
  
  
   someMC.onRelease = Delegate.create(_level0, doSomething);
  
   what i want to be able to do is know which instance of someMC actually
   called it...
  
   thanks
  
   p
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Delegate question...

2008-02-02 Thread Randy Troppmann
You can use an event proxy such as Grant Skinner's:
http://www.gskinner.com/blog/archives/2004/05/source_code_eve.html

- Randy


On Feb 2, 2008 10:52 AM, [p e r c e p t i c o n] [EMAIL PROTECTED]
wrote:

 you guys are indeed the best

 many thanks
 p

 On Feb 2, 2008 5:28 AM, EECOLOR [EMAIL PROTECTED] wrote:

  class fly.Delegate extends Object
  {
static function create(obj:Object, func:Function):Function
{
   var returnFunction = function()
   {
  var self:Function = arguments.callee;
  var target_obj:Object = self.target_obj;
  var func:Function = self.func;
  var userArguments_array:Array = self.userArguments_array;
  return func.apply(target_obj, arguments.concat
  (userArguments_array));
   };
 
   returnFunction.target_obj = obj;
   returnFunction.func = func;
   returnFunction.userArguments_array = arguments.splice(2);
   return returnFunction;
}
  };
 
 
 
  Greetz Erik
 
 
  On 2/2/08, Muzak [EMAIL PROTECTED] wrote:
  
   You don't and should never have to.
   Create a custom button (MovieClip+Class) that dispatches an event (e.g
 .
   release), rather than using a generic Button/MovieClip
   symbol.
   So instead of:
  
   someMC.onRelease = Delegate.create(_level0, doSomething);
  
   you'd then use:
  
   function doSomething(o:Object):Void {
   trace(o.target);
   }
   someMC.addEventListener(release, Delegate.create(this,
   doSomething));
  
   regards,
   Muzak
  
   - Original Message -
   From: [p e r c e p t i c o n] [EMAIL PROTECTED]
   To: Flash Coders List flashcoders@chattyfig.figleaf.com
   Sent: Saturday, February 02, 2008 1:02 AM
   Subject: [Flashcoders] Delegate question...
  
  
Howdy,
Quick question...How can I pass vars if i'm using delegates for
   handlers
I have it set up like so...
   
   
someMC.onRelease = Delegate.create(_level0, doSomething);
   
what i want to be able to do is know which instance of someMC
 actually
called it...
   
thanks
   
p
  
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Save MC as JPG

2008-02-02 Thread Dave Mennenoh
Does this make sense to anyone - I have a jpeg outputter working for the 
most part. However, I just swapped out my test clip, for a different image 
and it seems any other image (MC) I try to use just shows up as solid 
white - with the correct dimensions though. I tried a couple different ones 
same thing... drop back in my original test and it works. Anyone seen 
something like this?



Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Event Handling in ActionScript 3

2008-02-02 Thread EECOLOR
just can't think of one now.

The most common case where you do not extend the EventDispatcher is when you
need to extend the Proxy class in order to catch dynamic method and property
calls. In that case
you need to extend a class that does not extend EventDispatcher itself
you can do something like this:

public class Test extends Proxy implements IEventDispatcher
{
   private var _eventDispatcher:EventDispatcher;

   public function Test()
   {
  _eventDispatcher = new EventDispatcher(this);
   };

   public function dispatchEvent(event:Event):Boolean
   {
  return _eventDispatcher.dispatchEvent(event);
   };

  public function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean =
false):void
   {
  return _eventDispatcher.addEventListener(type, listener, useCapture,
priority, useWeakReference):void
   };

   ...

};


Greetz Erik


On 1/29/08, Guybrush Threepwood [EMAIL PROTECTED] wrote:

 Thank you again!
 I can't think of a reason not to extend EventDispatcher. I think most
 classes in AS3 seem to be a subclass of it.
 I'm sure there must be cases where you can't just extend EventDispatcher.
 I
 just can't think of one now.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Bundle swf's on server for transport to client

2008-02-02 Thread EECOLOR
With AS2 this indeed seems
tricky. With AS3 you could just zip the stuff, unzip within your Flash
application and load the bytes. Your best guess is a tool like swfmill
that has
the ability to
create swf's on the server. I only know of a library in java that has
the ability to generate swf's (javaswf).

If the content you are loading in is created within flash you might be able
to convert it to actionscript drawings (think lineTo and beginFill, etc).
This allows you to convert those commands to a text or xml file and run them
in your main application.


Greetz Erik


On 1/30/08, Gert-Jan van der Wel [EMAIL PROTECTED] wrote:

 Hi list,

 I'm working on the Flash app of
 Floorplannerhttp://www.floorplanner.com/tryit/ and
 we are having some problems with the loading of all the swf's. The Flash
 app
 (AS2) consists of 1 main app that loads several forms (the windows you
 see,
 like the library). The library holds a lot of furniture elements, which
 are
 separate swf's that are loaded one by one.


 When someone creates a floor plan and adds furniture to it, it's not
 strange
 that the design holds more than 50 furniture
 elementshttp://www.floorplanner.com/vyy1fm/Verdieping/Lekkeeerrr.
 Though all elements are small swf files, it takes a lot of time to handle
 all resource requests on our server. So my question is: is there a
 technique
 that makes it possible to (dynamically) bundle a set of swf's on the
 server
 and transport it to the client?

 Right now I'm testing with swfmill and it looks promising, but it seems a
 little buggy...


 I hope someone can help me out and point me in the right direction.

 Cheers,
 Gert-Jan
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Resizing a background image only.And keeping aspect ratio.

2008-02-02 Thread Vlado Krempl
Hello everyone,


Question:  (Using actionscript 3) 

How to scale just the background image (photograph) fullscreen in the browser 
but still keep it's aspect ratio.
All the solutions on the internet seem to still be in Actionscript 2.  I'm 
using the code below -
 
-

stage.addEventListener(Event.RESIZE, onStageResize);
 
 function onStageResize(event:Event):void {

picture_mc =  
 
 }
--

I've tried stage.stagewidth and scaleX = stage.width; but they all distort the 
image when resized.

Anyone have a clue?

Thanks.



Vlado
 
Please consider the environment before printing this e-mail. 
The contents of this message should be treated as COMMERCIAL IN CONFIDENCE 
unless otherwise specified in the message
and is intended solely for the use of the individual or entity to whom it is 
addressed.
If you have received this email in error please notify the sender. If you are 
not the named addressee you should not disseminate, distribute or copy this 
e-mail. 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Catching an error from a component

2008-02-02 Thread EECOLOR
I am not sure how it is possible that the item has been removed from the
display list. I however take your word for it :) Since you can not put a try
/ catch block (or check) around error area the solutions are limited.

My first thought was to extend the component and override the
thumbReleaseHandler, this method is however most likely private and thus can
not be overridden. You could however try this:

scrollbar.addEventListener(MouseEvent.MOUSE_UP, _listener, false, 1);

function _listener(e:MouseEvent):void
{
   //check if the scrollbar is part of the display list
   if (!scrollbar.stage)
   {
  //It is not in the display list, stop the event from being dispatched
to the default dispatcher
  e.stopImmediatePropagation();
   };
};

In the above code you add a listener that has a higher priority than the
internal listener of the scrollbar. Within the listener you check if the
scrollbar has still has a stage reference (which means it is still part of
the display list).
If it has not, you tell the event dispatcher to stop dispatching the event.

Before you try this code I would urge you to check the setup of your
application as it (usually) should be avoidable to have this error in the
first place.


Greetz Erik


On 1/29/08, Helmut Granda [EMAIL PROTECTED] wrote:

 I have a scroll component that sometimes is deleted from the display list
 while the user is holding the scroll bar and I get this error:

 TypeError: Error #1009: Cannot access a property or method of a null
 object
 reference.
 at fl.controls::ScrollBar/fl.controls:ScrollBar::thumbReleaseHandler()

 We know this error is fired since the scroll component is non-existent by
 the time the user releases the scroll bar...I am trying to catch it but
 not
 sure how should I catch this type of error since this is fired from within
 the component...

 I have tried the following:

 sp.addEventListener(MouseEvent.MOUSE_UP, catchError);
 sp.addEventListener(MouseEvent.MOUSE_LEAVE, catchError);

 and so forth... I am still trying but some suggestions would be great.

 Thanks,
 Helmut
 _

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Video has no mouseEnabled, help (AS3)

2008-02-02 Thread EECOLOR
In case this doesnt help you could also check out the property:
mouseChildren and do something like parent.mouseChildren = false;

Greetz Erik


On 1/25/08, Matthias Dittgen [EMAIL PROTECTED] wrote:

 Hi!

 oh, I found a solution. I have to do a parent.mouseEnabled = false,
 too, because parent is the parent of the video as well as the sprite.
 That's it! Oh, this saves my day! :-)
 Your suggestion would become my next attempt, Glen. I am glad, I now
 don't have to do that.

 Matthias


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to call custom method on loaded AS3 swf?

2008-02-02 Thread EECOLOR
This is the perfect example as to where you would use an interface:

Interface definition:

public interface MyFrameworkInferface
{
   function startup():void
};


Class in the swf that is loaded in:

public class MyLoadedClass
{
   public function startup():void
   {
   /stuff
   };
};


Accessing the method:

var loadedClass:MyFrameworkInterface = MyFrameworkInterface(
gameLoader.content);
loadedClass.startup();


I just needed to compile the class into my View

In most cases you want to prevent the main application from compiling
specific classes used in swf that are loaded
in. Interfaces are a perfect solution here, they act as the contract
between the loader and the loaded.


Greetz Erik

On 1/13/08, Adrian Park [EMAIL PROTECTED] wrote:

 Thanks all for your replies. Slight delay in responding due to trying to
 solve the problem whilst trying to make tangible progress on the project
 at
 the same time!
 Muzak, although I didn't try your suggestion, I suspect it would have
 worked
 but I feel it's much the same as the solution I used in the sense that
 it's
 tricking the compiler. If I'm tricking the compiler it means I probably
 haven't understood something properly and that keeps me awake at night :)

 Steven, thanks for that link. It's very interesting but, in this case, my
 initial instinct and August's suggestion was correct - I just needed to
 compile the class into my View and then cast gameLoader.content when I
 want
 to access its custom methods/properties.

 August - you were exactly right! I had tried this before but, what I
 discovered was that the game I was loading (authored by someone else) was
 throwing a runtime error when I tried to run it and I had misinterpreted
 the
 error as a problem with my code. Weirdly, this runtime error was not
 thrown
 when I ran the game on its own! Anyway, I tracked down and fixed the
 problem
 in the game code and now all is working well.

 August, if you want to discuss our frameworks and MVC further, feel free
 to
 contact me direct at [EMAIL PROTECTED]

 Thanks all,

 Adrian Park


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question about Arrays

2008-02-02 Thread EECOLOR
I believe it's type * so you should cast it.

This has nothing to do with that, hehe. There is a tiny difference beween
ClassToCastTo(value) and (value as ClassToCastTo). In the first case a
compiler error will be thrown. In the second case the cast will be tried. If
it fails the resulting value will be a null value.

why is -it- working

The pop method is typed as Object. Object is a dynamic class which means you
can add properties at
runtime. This in turn means that the compiler can not complain about
you calling a property that might not exist as you might be adding it
'dynamically' before you call it,


Greetz Erik


On 1/12/08, Mark Winterhalder [EMAIL PROTECTED] wrote:

 On Jan 11, 2008 11:34 PM, Mark Lapasa [EMAIL PROTECTED] wrote:
  I too would expect that it would need to be casted.

 Yes, one would think so.

 I can't answer your question, either, but can't help but note that in
 haXe you would declare your array as ArrayMyClass. The compiler
 wouldn't let you put anything else into it, and likewise, everything
 you'd pull out would be of type MyClass. haXe has a great type system
 (including implied types and type templates), so if you're the kind of
 coder that wonders about issues like that, I recommend you have a llok
 at http://haxe.org.

 Mark
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 type coercion error

2008-02-02 Thread EECOLOR
The only thing I can think of is that it is most likely
a problem concerning the ApplicationDomain. You probably load the swf into
its own application domain, which means it will use the AbstractPreloader
class of the swf instead of the one in your main application. The solution
here would be to load the swf like this:

var context:LoaderContext = LoaderContext(false,
ApplicationDomain.currentDomain = null, SecurityDomain.currentDomain);

loader.load(my.swf, context);


Greetz Erik


On 1/18/08, Steven Sacks [EMAIL PROTECTED] wrote:

 I am loading in a SWF with a document class of PreloadPage, which
 extends AbstractPreloader. When I try to cast _loader.content as the
 super class, I get a coercion error.

 TypeError: Error #1034: Type Coercion failed: cannot convert
 [EMAIL PROTECTED] to com.gaiaframework.pages.AbstractPreloader.

 var _preloader:AbstractPreloader;
 _preloader = AbstractPreloader(_loader.content);

 public class PreloadPage extends AbstractPreloader implements IPreloader
 {

 public class AbstractPreloader extends AbstractBase implements IPreloader
 {

 Can somebody please explain why I can't cast a subclass as its parent
 class in this case?  This doesn't make sense to me...

 --
 Steven Sacks
 Flash Maestro
 Los Angeles, CA
 -
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders