[Flashcoders] Searching all ActionScript in an FLA

2009-09-17 Thread Arka Roy
I have FLA files from a client with numerous MovieClips and buttons
containing ActionScript all over the place.  I am not used to this, I only
started using Flash with AS3 and have always used a Document Class and
placed my ActionScript in external .as files.
I am trying to search through the ActionScript to find some text.  Is their
any way (tool etc.) to search through all ActionScript in a FLA?   Why
doesn't Adobe put in such a search function, it sounds so basic to me.  Or
am I not understanding something about Flash usage?

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


Re: [Flashcoders] MouseEvents on overlapping siblings in AS3

2008-09-02 Thread Arka Roy
Here's a very good article about how mouse events propagate.
http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html

You should be able to have more than one MC capture a single event, although
I haven't tried it.

A


On Fri, Aug 29, 2008 at 8:03 PM, Matthias Dittgen [EMAIL PROTECTED]wrote:

 Hello,

 this was probably asked before, but I can't find.
 Imagine two or more sibling MovieClips. Both listen to
 MouseEvent.ROLL_OVER. When the mouse rolls over the overlapping region
 I would like the event to be dispatched to both of them and not only
 to the one above the other? How can I achieve this without using
 hitTest or enterframe scripts?

 Regards,
 Matthias
 ___
 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] pythagoras question

2008-08-30 Thread Arka Roy
I think this is what you need.

---
angle = Math.atan2( endY - startY, endX - startX );
trainX = vectorLength * Math.cos( angle );
trainY = vectorLength * Math.sin( angle );
---

Notes:
1. I'm using atan2(), not atan().
2. The function atan2() takes (endY - startY) as its first parameter, and
(endX - startX) as its second.  It's easy to make the mistake of assigning
them the other way round.

Hope this helps.
A


On Thu, Aug 28, 2008 at 2:00 AM, allandt bik-elliott (thefieldcomic.com) 
[EMAIL PROTECTED] wrote:

 hi guys

 I'm doing something wrong in my pythagoras theorum but i'm not seeing what
 it is right now

 i'm trying to find out the coordinates for a point on a line. I know the
 start x, end x, start y, end y, c length for the line and i know how far
 along c the point should be (call it vector length) but i'm a little
 stumped
 as to where to go from there

 the psuedo code for what i've been trying is

 vector x = start x / end x
 vector y = start y / end y
 train x = (vector x * vector length) + start x
 train y = (vector x * vector length) + start y

 I think i have my maths very wrong here - hope you guys can help

 a
 ___
 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] Function = String

2008-08-30 Thread Arka Roy
I'm pretty sure there is no reflection-type functionality in AS3 to return a
method name.

Maybe you can define a bunch of string constants (perhaps even as static
members in a class you create for this purpose, to hold them in one place)
and use them as parms to addCallback().

Then you would still have to make sure there are no typos in the function
names you use to initialize them, but the compiler will inform you whenever
you are spelling them incorrectly when sending them as parameters to
addCallback().

(I hope I am understanding your question).

A


On Tue, Aug 26, 2008 at 2:57 AM, Rob Sampson [EMAIL PROTECTED] wrote:

 I've been working with ExternalInterface.addCallback, and I think it's a
 drag that you have to send the name of a function as a String - it seems
 like there should be a way to get the name of a function dynamically the
 same way Event uses public static constants for their strings – so the
 compiler can find my misspellings! It's not a huge problem but (as with
 everything in the ExternalInterface) it seems like the implementation
 wasn't
 thought out, and doesn't jive with the rest of the language. So how about
 it
 gurus...any cool toString/prototype/constructor override tricks?
 ___
 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] pythagoras question

2008-08-30 Thread Arka Roy
Let's call the position of the mouse click on the stage (clickedX, clickedY)
The starting coordinates are (startX, startY)
The ending coordinates are (endX , endY)

The general equation of your line, for any variables X and Y, is:
Y == (X - startX) * (endY - startY) / (endX - startX)

So when the user clicks on the stage, the values of clickedX and clickedY
would need to satisfy the following equation:
clickedY == (clickedX - startX) * (endY - startY) / (endX - startX)

If this is true for clickedX and clickedY then that means the click fell on
the line.  Of course you would probably have to provide a bit of an error
margin because you can't accurately evaluate the equality (==) of real
numbers.

A



On Sat, Aug 30, 2008 at 9:18 PM, Weyert de Boer [EMAIL PROTECTED] wrote:

 May I ask a related question? How can I detected if a user has clicked on a
 line (or later a bezier path) ? I am having the starting and ending
 coordinates of this line and so also the distance.
 Now I am would like to check if the user has clicked within this line
 with/or without a specific radius. I am currently a bit clueless how to
 solve this problem.

 I know it's close what you have given earlier.

 Yours,
 Weyert

 ___
 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] Plssss help me: perspective illusion

2008-08-30 Thread Arka Roy
Can you please describe the problem in terms of something in Flash or
ActionScript (like variables, symbols, classes, functions) not working as
you thought it should.

Or at least which specific part of that code you posted, doesn't work as
expected.

A


On Sat, Aug 30, 2008 at 9:36 PM, Rajiv Seth (Pixelated) 
[EMAIL PROTECTED] wrote:

 Hi there,

 I am working on a project, for which I have made perspective movement of
 thumbnails. My one side movement is working fine, but I am unable to create
 to and fro movement (back  forward), as variable values don't change as
 desired. Can anyone help me with this and tell me how to code this.

 file can be seen at http://www.geocities.com/cybe_r/

 I have put there fla download link and code too.
 --
 Regards

 Rajiv Seth
 Ph: 09839157388
 ___
 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] Fading previously-drawn lines

2008-08-23 Thread Arka Roy
Hello,

I am a Flash newbie, but an experienced programmer (C/C++).

My requirement is to have an arrowhead traveling along a specific path on
the stage, leaving a trail behind.  As the arrowhead moves along, the trail
left behind needs to progressively fade.  The oldest part starts fading
first, so it is always the most faded.

By the time the arrowhead reaches its destination the oldest part of the
trail, furthest from the arrowhead, should be quite transparent, maybe an
alpha value of 10% or so, and the newest part of the trail, adjacent to
the arrowhead, should be a solid 100%.

The motion of the arrowhead was made by an animator.  I need to work with
that.

I am currently doing this as follows:
1. I start out by initializing a Shape, with a thick solid (red) line style.
2. I set the drawing pen position at the initial position of the arrowhead
using moveTo()
3. One each ENTER_FRAME event, I use lineTo() to draw a line to the current
position of the arrowhead.

And so on.

So what I would like to do is in each frame, after several frames have
elapsed, is to start fading the oldest line segment, then a couple of frames
later start fading the second-oldest, while continuing to further fade the
oldest, etc.

Is it possible to access the older lines?  I know how to fade the entire
Shape (trapezoid?) but not specific segments.

I tried the method of creating a new Shape every frame, just a line segment,
that I accumulate in an array.  That way I can fade them all separately
according to how old they are.  However the problem I had with this was that
the lines end up overlapping at a point, because I was doing the following.

Frame n:
create new segment
moveTo( 100, 100 )  // the previous position of the arrowhead
lineTo( 104, 104 )  // the current position of the arrowhead

Frame n + 1:
create new segment
moveTo( 104, 104 )  // the previous position of the arrowhead
lineTo( 100, 108 )  // the current position of the arrowhead

So both of the lines share a point at (104, 104).  As I fade out the lines
by decreasing their alpha values, it seems at this shared spot the alpha
values have an additive effect, and the spot is more opaque.  So the end
result is that while the path is incrementally faded as I want it to be, it
is punctuated with these thick spots.  I don't want those, I just want a
smooth continuous incremental fading.

Is there a way to access the pixels of that spot, where the two lines
intersect, and fade them to some transparency level?  The lines are a few
pixels thick (maybe 2 or 3 or more, depending on what the client likes) so
that interecting point is not just a single pixel.

I also tried staggering the starting point of each new segment, based on the
direction of the line, so that it doesn't overlap with the previous line.
But this was really ugly and jagged looking.  There may be an intelligent
algorithm or heuristic for this but I don't have the time or budget to make
a big deal of this.


Here is a link to help clarify things.  It doesn't satisfy the requirement,
since there is no incremental fading, it is all equally faded except for the
line attached to the arrowhead.  It also doesn't exactly employ the methods
I describe above, it is just one of my many trials incorporating a few
technquies.  I am just linking it to help this discussion.  If, on the other
hand, it is confusing please ignore it.
http://arka.sunnyday.jp/script/escort/hokkaido_01.html

Thanks,
Arka Roy
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Nested SWFs

2008-07-09 Thread Arka Roy
I don't think this is possible, unless you actually load that asset library 
from within the page1.swf's document class.  

Here is how I instantiate assets from an asset library.

--
private function loadAssets():void
{
var req:URLRequest = new URLRequest( myPath/myFile );
var ctx:LoaderContext = new LoaderContext( false, 
ApplicationDomain.currentDomain );
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener( Event.INIT, loadAssetsDone );
ldr.load( req, ctx );
}

private function loadAssetsDone( e:Event ):void 
{
var assetClass:Class;
assetClass = getDefinitionByName( myAssetClass ) as Class;
// mAssetObj needs to be declared somewhere
mAssetObj = new assetClass();
}
--

I wonder if instead of the way I'm doing it, you were to hold onto assetClass 
as a member variable of the index.swf document class, for example mAssetClass.  
One thing to try would be to pass this as a parameter to your loaded 
page1.swf's document class and then trying to do a new assetClass(); on it.  I 
have no idea if this will work, maybe you can report back.

Sorry for only being able to offer a shot in the dark.  I've had a tremendous 
amount of grief myself with loading swfs within swfs, and also with asset 
libraries.  Flash behaves in all manner of unpredictable and unintuitive ways.  
One basic problem is that I don't deeply understand the concept of a 
LoaderContext or the ApplicationDomain, and have not had the time to look into 
it.

Arka




- Original Message 
From: Mike Grunwald [EMAIL PROTECTED]
To: Flashcoders flashcoders@chattyfig.figleaf.com
Sent: Wednesday, July 9, 2008 2:21:18 AM
Subject: [Flashcoders] Nested SWFs

Hello all,

I'm new to AS3  and using multiple SWFs in an application. I'm used  
to AS2 and 1 or 2 SWFs at max.

I'm using the GAIA framework (not sure if you're all familiar) which  
seems to rock so far!, but I'm confused on a couple issues:

I have a few SWFs that load into one another (i.e., main/index/nav/ 
page1).
I would like to load a remote asset library into the index.swf (since  
this page never unloads) and access the contents of the library from  
page1.swf (and page2, page3, etc.).
I can get everything to load fine and all my movieclip classes are  
accessible from the SWF that I load the remote library into.
I just can't figure out how to target them to create new instances  
through the page1.swf?

Does that even make sense???

Any help would be greatly appreciated.
Thanks in advance,
_mike g.


___
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] Getting dimensions of visible area

2008-06-28 Thread Arka Roy
Hi,

My first post.  

I'm a newbie at Flash but was a game programmer (C/C++) for a long time.  I'm 
finding Flash to be highly quirky and very interesting.

I have a question about images imported from Illustrator CS3 with masks.

These images have artifacts outside of their visible area.
For example, it can have a picture of a dog's face, but one of the
long ears is off to the side, outside the visible region of the piece.  We 
cannot crop the piece for our own reasons, but the mask makes it such that the 
ear sticking out is invisible in
Flash, when we turn it into  a movie clip.  Also, the Info panel in the Flash 
IDE correctly shows the width and height of the visible area ONLY.

However, in ActionScript when I try to get the width and height using the 
DisplayObject width and height properties it returns the dimensions of the 
entire image including the hidden portions.

You can see them here:

Visible area only
http://arkaroy.e3b.org/scraps/piece.jpg


Entire image with visible area masked in red
http://arkaroy.e3b.org/scraps/mask.jpg


I want to be able to get the width and height of the visible area in 
ActionScript.  Is this possible?  The fact that the Player knows there is a 
mask and correctly hides the outer parts indicates that it should have that 
information somewhere.

By the way, all mention of dimensions I've made here pertains to bounding boxes.

Thanks,
Arka Roy


  

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