ActionScript 3.0 :: Create A Generic Function?

Aug 28, 2009

I'm trying to create a generic function. Let me explain. Let's say I have an xml structure as follows:

Code:
<tree name="icons-b demo">
<folder name="OverLook Hotel" icon="./icons-b/building.png" path="2062095255112918">

[code]......

View 7 Replies


Similar Posts:


Actionscript 3 :: Border Container Create Generic MouseOver Function?

Dec 15, 2011

I try to create a function to change border property of border container.To do that I create a function for each border container on my MXML.But I'd to code better and to do a generic function.Today my function is:

protected function bcContact_mouseOverHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
bcContact.setStyle("borderVisible",true);

[code]....

bcContact is one border container Id.I try to replace bcContact by this but it doesn't work.

View 2 Replies

ActionScript 2.0 :: How To Create Generic Activity Interactions

Jun 15, 2004

As I have done all my work for the week already I have been given the basically pointless takes of creating generic functions, classes and maybe components for a number of possible e-learning interactions for the projects we have, things such as sliders, drag and drops, multiple choice questions, scenario driven things and so on. How would I go about making things like this generic? The graphics will always be different and more then likely so will the kind of things needed from them, in many cases we don't know the capacity these things will be used in!

View 2 Replies

ActionScript 3.0 :: Function Handling Generic Vectors?

Jul 22, 2010

I have this question regarding vectors. Is there a way where I can make a generic utility method which would for example, subdivide a vector into two vectors and would be able to handle all types of vectors, whether they contain <int> or <string> or <myClass>

for example:

ActionScript Code:
public function splitVectorIntoTwo(v:Vector.<T>):Vector.<Vector.<T>> {
var result:Vector.<Vector.<T>> = new Vector.<Vector.<T>>();
//Do logic
return result;
}

I don't know if this is possible but else it hinders our development quite a bit by using vectors since we can't use some generic utility methods as they will not accept generic vector types and you have to create a specific method for every vector type, one for Vector.<int> one for Vector.<string> etc.... With arrays, since they are not type-safe they can be passed within every such method.

View 2 Replies

ActionScript 3.0 :: Return Generic Type Value From A Function?

Sep 22, 2011

how to return a generic value from a AS 3.0 function/method ex:

function MyFun():GenericType{
// if int
return 10;
// if string

[Code].....

View 2 Replies

ActionScript 2.0 :: [fmx] Generic Function To Move Objects?

May 14, 2004

Alright so... I really don't know the best way to approach this. I had a LOT of code that I thought could be generalized into a function. I don't know how to explian it... here is the code:i attached it...I know it's a lot of code... I just... I don't know what to do with it anymore! When it was in a bunch of small functions, it worked (sort of) just seemed reallly messy and annoyed me.Oh btw its causing the hero to jsut go to 0,0 and then a hit symbol appears there, and then nothing happens, the hit doesnt even dissappear.

View 7 Replies

ActionScript 3.0 :: Generic Function To Place A Component On The Stage?

Apr 18, 2009

My requirement/need  is the AS3 code for placing any type of Component(viz., Button, CheckBox, ComboBox, ListBox, radiobutton, Slider, Scrollbar,Label,TextField, etc.,) on the stage with desired width,height, X and Y parameters(values) which we mention in "Properties" tab of Properties Window in flash. Hence, What i need is, (say)a generic ActionScript 3.0 method/function, which places any of the components present in "Components Panel" onto the stage. the function prototype or signature may be like this:

function addComponent(int <width>, int <height>, int <XPos>, int <YPos>)
 
t is a general query i think so. i.e., A basic programmer's task for defining a function for my requirement.I think,if I want to add a Button onto the stage at 100,100 pixel position and the button component's width and height are 50,50 respectively, (i.e., button.X=button.Y=100 && button.width=button.height=50).So, a button must be placed at 100,100, then, the sample code looks like this:

Button <btn_instance> = new Button();     //creates Button instance
<btn_instance>.addComponent(50,50,100,100);// properties of button.

View 2 Replies

ActionScript 2.0 :: Grasp Applying Generic Function To Mc OnEnterFrame's?

Dec 17, 2004

So, I'm a beginning to intermediate Flash and AS guy grappling with some programming concepts.I find that when I create my own functions from scratch, especially to define a generic function to different movie clips, in this case to their onEnterFrame functions, I get unexpected results.The bottom is some code from a new simple website I'm trying to code. My problem is that I can't get the function working in a generic way. I know I may be taking the completely wrong approach and totally missing something, but I am continuously coming up with problems (seems to be a misunderstading of scope at a deeper level, not simple variable timeline scope, but inherant scope within functions, etc..).So, I will just copy paste the code here and try and comment as much as possible. For claritie's sake I will remove button codes except option1 and option2.

//initialization of a few global and one timeline variable. These should
//be self explanatory in the code so I wont go into to much detail
//my probs arent in the detail but in the overall relationship of the

[code].....

View 7 Replies

ActionScript 2.0 :: Turn OnClipEvent Code Into A Generic Function?

Apr 24, 2006

I am trying to turn the following code (which works well when applied to a _mc) into a generic function I can use on the first frame of my main timeline:

Code:
onClipEvent (load) {
this.speed = 0; // current tween velocity
this.tScale = 100; // target scale[code]..........

Have tried various ways without success.

View 5 Replies

ActionScript 3.0 :: Generic Function To Place Component On Stage?

Apr 18, 2009

I am new to flash and ActionScript 3.0.I am learning ActionScript 3.0. My requirement/need is the AS3 code for placing any type of Component(viz., Button, CheckBox, ComboBox, ListBox, radiobutton, Slider, Scrollbar,Label,TextField, etc.,) on the stage with desired width,height, X and Y parameters(values) which we mention in "Properties" tab of Properties Window in flash.

Hence, What I need is, (say)a generic ActionScript 3.0 method/function, which places any of the components present in "Components Panel" onto the stage. i.e., As per my idea, the function prototype or signature may be like this:
function addComponent(int <width>, int <height>, int <XPos>, int <YPos>)

i.e., A basic programmer's task for defining a function for my requirement. I think,if I want to add a Button onto the stage at 100,100 pixel position and the button component's width and height are 50,50 respectively,
(i.e., button.X=button.Y=100 && button.width=button.height=50).
So, a button must be placed at 100,100, then, the sample code looks like this:
Button <btn_instance> = new Button(); //creates Button instance
<btn_instance>.addComponent(50,50,100,100); // properties of button.

View 2 Replies

Actionscript 3 :: Combining Functions To Make One Generic Function That Applied To Multiple Images

Nov 11, 2010

I have these images that will load when I input a certain string of text but I don't know how to combine functions to make a generic one that will work for all of the images. These are just two and they're basically the same thing except I have to make each function (something)1 and then (something)2 for the next image.

[Code]...

View 2 Replies

ActionScript 2.0 :: Create Base Url Function And Button Link To Call That Function?

Jun 16, 2010

How create baseurl function in flash and how i call that function in button script

View 1 Replies

AS2 :: IDE - Create Xml In Function Refer From Outside Function?

May 25, 2009

I need to create a new xml from within a function, then refer to it outside of that function.example:

Code:
function xmlIt(array) {
var results_xml = new XML();

[code]......

View 3 Replies

Asp.net :: Cannot Get Session In Generic Handler

Nov 5, 2010

I am now using FancyUpload (flash upload) to allow user to upload files in a small project. I use Generic Handler to handler in server when user uploads his file, but I'm getting error:
Can't get session in Generic Handler (.ashx) when using Firefox or Chrome etc except IE
I read so many solution and finally found out that Flash has some bug that can't send cookie in Firefox or Chrome except IE. Maybe I can check the session in Flash before it's start to send the file to the server or check session in Generic Handler before save it, How to do it?

View 2 Replies

Flex :: Designing A Generic Toolmanager?

Aug 14, 2011

I want to handle multiple operations on a UI Component (button ,textfield, swfs,custom objects etc) in like scaling,skewing ,color,rotations etc etc and save them too. Earlier the actions were done

using a single tool and single mxml file but now the tool is separated into different tools. Was wondering how i can design / use something like Toolmanager class to handle actions etc?

Also the tricky part is that some objects can have more operations defined for them Like 'object1' has 3 operations that can be performed on it and 'object2' has 5 operations defined on it.

We are using MVC design pattern but no frameworks as such. What are the different design patterns that can be used to do this? Edit: To be more precise i want implement this in AS3 OO way.The application is similar to drawing application which supports addition of various images,text,audio,swfs etc. One added user can perform various operations of the objects..like adding color,scaling skewing,rotation etc etc and custom effects and after that export the drawing as PNG.Likewise some effects that are applicable to text are not applicable to images and vice versa. and some effects can be common.

View 2 Replies

ActionScript 2.0 :: Combining Two Generic Objects?

Jul 30, 2008

I just want to combine two objects and their properties together.

For instance if I have...

Code:
var appleObj:Object = new Object();
appleObj.type = "apple";
var orangeObj:Object = new Object();

[Code].....

View 5 Replies

ActionScript 3.0 :: Generic Class For Webservices?

May 12, 2009

I'm just getting started connection to webserivces and I have looked at a lot of tutorials and I get most of them to work but I'm having a little bit of a problem. I'm coding in eclipse with the flex plug-in and I'm using flash to complile it. I'm trying to come up with a generic class for my webservices where I can just pass in the wsdl and any params and it will run. I'm using the webservicex for my wsdl in this example. Here is the code below and it works great and returns an XML.

[code]...

Now the problem. I have a specific wsdl, NOT THE ONE ABOVE, that I pass in a lot of params, which isn't a problem, and it seems to be sending them all just fine but when I trace the result I keep getting [object, object]. how to turn this into and XML, or why it is coming back as an object?

View 1 Replies

ActionScript 3.0 :: Generic Array Deletion & Insertion?

Jun 23, 2010

I was going through the options the generic Vector class offers to delete and/or insert items from/to an array, and it seems to me that the only way is by using the Splice method. For me, this method does a lot of work I dont utilize in my code (like creating a new array as a result etc.), hence
 
is there an optimized way how to delete a certain item from a vector, instead of calling myVector.splice(idItemToRemove,1) ?

View 1 Replies

ActionScript 3 :: Difference Between Value Object And Generic Class?

Jan 9, 2010

I don't understand what is structurally different between a Value Object and a Class in ActionScript3. Can any Class be a VO if you decide to call it one?

View 1 Replies

Actionscript 3 :: Generic Way To Get Reference To A Method's Caller?

Dec 21, 2010

I have 2 classes representing 2 objects. From the "whoCalledMe" function, I want to find out what object called the function (without passing that information in as an argument). I've used a make-believe property, "caller", that would give me the reference I'm looking for. Is there a generic way I can get a reference to the caller from there?

package {
public class ObjectCallingTheFunction {
public var IDENTITY:String = "I'm the calling function!";

[code]....

View 4 Replies

Flex :: Deep, Generic Serialization Of Objects?

Jan 24, 2011

Is there any way, without having the creator of the object implement any special functions (no specific serialization functions) (however, they can use annotations), to have Flash serialize a generic, possibly deep (objects within objects within objects, etc, etc, etc) object?

View 2 Replies

Flash :: Access A Generic TWAIN Scanner?

Feb 4, 2011

Is it possible to have flash access a generic twain scanner from my web-application, save the file and upload it into my application?

I have done some searching through google but wasn't able to find to much detail in this. Is there any pre-made solutions, Paid / Free (ideally).

If Flash isn't the best route to go, would Java Applet be better, if so, is their a solution already built?

View 1 Replies

Flash :: Wire Different Backend Solutions Into A Generic API?

Feb 25, 2011

I have to produce a generic API that provides game tracking functions (track what was clicked, track if a certain event occurred, etc). This generic API needs to wire into one of two (or more) bespoke tracking solutions provided by third parties (e.g. itracku.com and itrackutoo.com) in the background.The bespoke tracking solutions sport similar functions (trackClick, trackEvent), but vary dramatically in the number of arguments they require (e.g. one requires 1 argument to be passed, the other 6).In order for the generic API to easily switch between hitting either bespoke solution, am I right in assuming that ALL arguments need to be scoped out beforehand in order to facilitate switching tracking solutions? The desire is to NOT have to recomplie .swfs in order to switch tracking solution (i.e. it's switched via an XML config). I was thinking of achieving this by having my generic API functions accept a single object as an argument, e.g.[code]

View 1 Replies

ActionScript 3.0 :: Accessing Parameters Of Generic Object?

Mar 4, 2011

Is there a way out there to essentially loop through a generic object to find out what parameters/properties are being used and/or what there names are?

ActionScript Code:
var obj:Object = new Object();
obj.foo = "hello";
obj.bar = "world";
//... and on for however many params you need
[Code] .....

I might be trying to do something that is essentially not possible, but I'm just thinking it would be very nice sometimes to access different parts of an object without having to directly know what the param name is...

View 3 Replies

ActionScript 3.0 :: Swc Giving Generic Parameter Names?

May 18, 2011

I've been creating .swc files lately but I keep having one nagging little issue. When I call methods from a .swc I created my code hinting shows my parameters with generic names instead of their actual names.For example here would be the source code of a function:

ActionScript Code:
public function traceMessage(message:String){
trace(message);
}

Once I export the .swc and use it my code hinting shows this instead:

ActionScript Code:
traceMessage(param0:String)

Notice how my parameter says param0 and not message.I'm exporting with CS5 setting the export .swc checkbox on the publish settings.

View 3 Replies

IDE :: Generic Event Listener For Both Mouse And Keyboard?

Mar 1, 2009

Can I use a generic Event listener for both mouse and keyboard ?Something like this ?

Code:
private function controlAction(e:Event):void {
if (e is KeyboardEvent) {

[code].....

View 1 Replies

ActionScript 3.0 :: Generic Swf For Loading Image Slideshows?

Apr 16, 2009

i have a swf that loads dynamic images from an xml. that part is working great. Also i give the swf a parameter with the xml to load through the embed code. thats working to.

What is not working I want to give the swf a height and width so i can use the same swf for multiple places and sizes. i've done it by giving absolute size to a container div and it seems to do the size job, BUT i cant get the images to load right. Ive tried every scalemode and images are expanded or they load way of the x=0, y=0 of the movie

View 2 Replies

ActionScript 2.0 :: Assigning MC Instance Name To Generic Variable?

Dec 6, 2003

I'm pretty sure there is a simple solution to this problem and I'm going to feel really dumb for not figuring it out myself but for some reason I am stuck so here goes. I have several movie clip "buttons". I would like, on release, to load a dynamic text file into a container clip on the stage. Pretty simple right? Here is the code I am using:

[Code]...

View 14 Replies

ActionScript 3.0 :: Creating Generic Actions For Multiple Objects?

Feb 3, 2010

want to simplify coding and wondered if there was a way to write a script that could be used on multiple objects without having to write it to address each object individually. I am building a simple menu where I want the menu link to rise and scale up when the button for it is rolled over and then return to its original position when the mouse rolls off. I know I can write this per button and per item, but wanted to see if there was a way to write it once and then apply the action to everything. EX. My menu consists of 5 items (and respective buttons) home_mc (home_btn), menu_mc, dining_mc, contact_mc, specials_mc.If I write the code

home_btn.addEventListener(MouseEvent.MOUSE_OVER, homeOver);
home_btn.addEventListener(MouseEvent.MOUSE_OUT, homeOff);
function homeOver(MouseEvent) {

[code].....

View 5 Replies

Actionscript 3 :: Flex 3: Determine If A Generic Object Is Actually A Button?

Aug 7, 2009

I have this bit of code, and it's not working as I expected. btnContainer is a VBox that contains a ton of buttons (toggle=true); and I want to reset them to un-toggled at a certain point.

for (var btn:Object in btnContainer.getChildren()){
if (btn.isPrototypeOf(mx.controls.Button)){
btn.selected = false;
}
}

With the above code, "btn" shows up as just the index during each iteration of the loop (0,1,2,3,...), and the conditional never evaluates to true.I also tried this:

for (var btn:Button in btnContainer.getChildren()){
btn.selected = false;
}

This works fine, except that there is also a label inside btnContainer; so it throws an error when trying to cast the label as a button.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved