ActionScript 3.0 :: Fetching A String Globally

Jun 5, 2011

For examples sake, say I have an 'Icon' class. When you set Icon's 'name' variable, it downloads the image (of the given name) from a server/directory.

The problem however, is that even though the name (of the image) is provided, the name of the server, or even the folder containing the image is not.

Of course, I could explicitly define the full name and location of the file to the class, but if I ever decide to change folder structure I would have to go through and find all references to the folder and change it. It also seems wrong to litter all of my parent classes with arbitrary URL's to feed to the Icon class.

The preference of course would be to 'globally request' the image server/directory on instantiation, but in the world of OOP how is this best achieved?

I was just about to have the Icon class dispatch a bubbling event, letting something at the end of the displayList catch the event/request and feed it the information (a String) it was looking for, but it didn't feel right. It feels like dispatchEvent should only be used to Dispatch Events, not request a string...

Also, I've come up to similar situations where I've needed a similar request structure without being an extension of EventDispatcher (such as just a primitive Object). Is there a best practice for both?

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Delay Of Fetching URl?

Apr 5, 2009

I've got the stop command in and the get url, what I wanted to know is if there is a line of code or something to dealy the fetch for like 5seconds? Also how after adding an animation do I keep it there, for instance I have three animations all starting at different parts and I need to extend the first one so the graphic stays in place. I tried just adding frames to each animations layer to extend it, but it fouls up the animation.

View 11 Replies

Flash :: Fetching Variable From Javascript?

Mar 2, 2010

I'm creating a quiz and as a timer in the quiz I have a flash movie (an animated clock). I poll the clock every second to see if the time for the quiz has run out.

[Code]...

First of all, it just fetches the flash movie object, and then calls some mehtods on the object. This works fine in Firefox (pc & mac), Safari (mac) but in IE8 on pc it returns 'unexpected error on line 3' (or any other line that uses the flashMovie object

[Code]...

View 2 Replies

Actionscript :: Flex Fetching Assets From A CDN

Mar 25, 2010

My main.swf loads symbols from other swfs at runtime. If I keep all the swfs(main and others)on my server, things work fine. But if I keep all of them on a CDN, one particular symbol won't display occassionally. With flash tracer plugin for firefox I am able to see that all the symbols have been loaded and their z-indices are as they should be.

View 1 Replies

Flex :: Data Fetching From The Server?

Apr 3, 2011

I have a Flex-based client app which "talks" to the back-end through BlazeDS. In one of my use cases there will be a so called "Photo Wall" view, which will present a number of the most recent photos, submitted from people and for locations the user is following (Facebook-like).

The thing is, the data in this photo wall has to be filtered by "All", meaning no filter, "Friends", meaning friends that the user is following, and "Locations", meaning locations the user is following. If I get data from the server only once (when the ALL filter is selected by default), I will store it locally, and the next time a user clicks on a filter, this local collection will be filtered locally. The problem is that I can't predict how many of all recent photos are coming from friends, and how many from locations, thus I may end up with a page that shows only one photo, where a minimum of 5 photos should always be present. I clearly don't want to deal with partial fetching and stuff like that.

The other way is making two separate requests to the server initially, one to get a collection of recent photos from friends, and one for locations. Thus I will make sure I have the bare minimum of photos for the filtered pages. When data arrives, the client will merge those two collections, sort by date, and voila there is the "ALL" collection (of course, repeating photos will have to be pruned while merging)Third, making this same thing down at the server level, by making two separate queries and then merging them.

View 1 Replies

ActionScript 3.0 :: Fetching Image From Xml Having Html Tag

Apr 29, 2011

I have a problem that em fetching image from xml having html tag. I want if someone click at that image it should magnify.secondly I have imported a swf in another but when I do it online it wont open at its correct place you can check this issue at esrtreatment.com/hma in project gallery tab.can some one tell me what that issue is as it open at its right place when i open locally.

View 0 Replies

Actionscript 3.0 :: Fetching Data From Database?

Aug 26, 2009

i am trying to build a web application wherein i have two display data in two text fields. one text will display the Resort name and the other one will display the URL related to the resort.There are only two fields.

View 5 Replies

ActionScript 3.0 :: Fetching Current Date (From Any Other Server)

Feb 24, 2011

My app needs to fetch the current date and I don't want it to come from the computer's clock. I've searched [URL] and other sites for APIs, but have come short so far. Is there a web service somewhere or any other dedicated server where I could fetch today's date from using AS3?

View 1 Replies

Actionscript 3 :: Make Page Carousel By Fetching Images From XML Using It?

Apr 5, 2012

I want to make a page carousel by fetching images from an XML file. I want the layout of pictures, and the pictures should scroll as i click the next button.

View 1 Replies

ActionScript 2.0 :: Dynamic Text Box Fetching The Current Date?

Dec 28, 2006

mytext.text = Date();

it doesn't work.

View 2 Replies

ActionScript 3.0 :: Declare A Filter And Use It Globally?

Aug 5, 2009

I have a flash project that involves using glow filters on several mcs all over the site, the problem is, the current way I'm doing it requires me to declare and assign the filter on every MC's container.

Is there a way where I can just declare the glow filter once on the maintime line, and then simply apply the filter on the MCs where needed?

this is what I use for every MC, and it's really tedious and hard to keep track of/change.

Code:
var Glow1:GlowFilter = new GlowFilter();
Glow1.color = 0xFFFFFF;
Glow1.inner = false;

[Code]...

View 2 Replies

Professional :: Globally Import Mx.transitions?

Jan 5, 2010

[URL].. lines a lot in our files to set up AS Tweens. Is there a way to import these globally on one frame of ActionScript instead of having to put it in AS for every time an MC is being tweened?

View 1 Replies

ActionScript 2.0 :: Referencing An Array Value Globally XML?

Mar 2, 2007

I have been trying to get this right for a few days now, but I am stumped. This code runs on the first frame of my movie:

Code:
_global.headingText = new Array();
_global.captionText = new Array();
_global.contentText = new Array();

[Code].....

View 1 Replies

ActionScript 2.0 :: How To Access Variables Globally

Nov 2, 2007

i assigned some variables called charstrength and so on but i want to access these variables globaly as the action is on the first frame with all the variables stated and on the second frame i need to access those variables but it just wont let me.

View 9 Replies

ActionScript 2.0 :: Control Different Sounds Globally?

Apr 16, 2010

I'm trying to control different sound attached in different frame. I want a button to turn on/off different sounds separately and globally. I mean after I've press one button in, let's say, Frame 1, it can turn off/on one sound attached in Frame 2 but another sound is not affected.

Right now, I've create 2 buttons for each sound to turn on/off the sounds sounds by setVolume() but I can work only when I entered that frame and press button in the frame. If I've press the button in Frame 1 and go to Frame 2, it did not take effect.

Here is my code for attaching different sounds in Frame 2:

Code:
infoSound = new Sound(infoSoundMc);
infoSound.attachSound("info");
alertSound = new Sound(alertSoundMc);

[Code]....

Is there any other command to turn on/off sound besides setVolume()?

View 3 Replies

ActionScript 3.0 :: Globally Mute Audio From Javascript?

Oct 19, 2010

I just started developing flash recently and I need to globally mute the audio in an swf by javascript ... I've got the following functions in my AS3 already.

Code:

function mute():void
{
var st:SoundTransform = new SoundTransform(0);
SoundMixer.soundTransform = st;

[code]...

Do I need to use addCallback() somehow to trigger this through javascript?

View 4 Replies

Media Server :: Globally Limit The Bandwidth Of FMS 3.5?

Mar 5, 2010

Is it possible to limit globally the bandwidth usage of FMS 3.5 ? I don't want FMS  to use all the bandwidth available via our ISP.I want my coworkers and other servers to be able to continue using Internet while sending/receiving data from/to FMS. I know it is possible to limit various bandwidths per Applications, but it seems there is no easy way - using the xml config files - to globally limit the server bandwidth.

View 2 Replies

Professional :: Globally Adjust Frame Spacing?

Apr 10, 2010

Is it possible to adjust the frame spacing for all layers?For example, I have my stuff (graphics, text, etc..) spaced at 24 frames. Is there a way to globally adjust everything to 48 frame spacing? or 12 frame spacing?

View 4 Replies

ActionScript 3.0 :: Globally Set TLF Text MouseEnabled To False?

May 31, 2011

I'm wondering if you can globally set TLF Text mouseEnabled to false without having to name every text box individually?

View 1 Replies

Actionscript 3 :: Import Class Globally In Flash CS5?

Dec 11, 2011

I have a project in ActionScript 3, Flash Professional CS5.5, and AIR 3. I have several custom classes that I need to access. Currently, I am successfully accessing via the traditional method:

import trailcrest.core.core;
var Core:core = new core();

However, I came to a realization in my code...this creates a COPY of the class, and doesn't give access to the original. This, of course is a problem - I need one symbol's scripts to modify a variable in the class, and another symbol's scripts access that changed variable. Obviously, right now, that is not occurring.How do I do what I am describing? Should I somehow create a "public var" for the class (though I need instructions on how to do that...I can't use "public var" within stages or symbols)? Is there some way to directly access the class?

View 4 Replies

ActionScript 2.0 :: How To Format Dynamic TextFields Globally

Sep 13, 2009

In my project, several textField mclips are created dynamically. These mclips pull their content from an XML from.

The text is formatting partially using TextFormat, but I have been unsuccessful setting the font family.

I think this is because the content is dynamic and called from the XML.

In any case, I then tried to set the font family using mx.styles, but also with no luck:

import mx.styles.CSSStyleDeclaration;
var text_style:Object = new CSSStyleDeclaration();
_global.styles.myStyle = text_style;

[Code].....

View 3 Replies

ActionScript 2.0 :: My Global Variables Are Not Behaving Globally

Feb 4, 2010

I have defined Variables at the start of my script, with _root, to make them valid globally.

Then, in several functions and IF loops, I change the values of these variables, again referencing them with _root.

Then at the end of my script, I want to collect these global variables and send them to a PHP file to late store them in a db.

The problem is that at the end of my script, the variables do not contain any data, I used trace() to test this.

They only seem to contain values inside the IF loops which would mean they are behaving as local variables only?

I also tried replacing _root with _global but got the same results.

I have over 1000 lines of code at the moment so I will only post a snippet here of the general method I used, perhaps some experienced users will spot what I am doing wrong[code]...

View 5 Replies

ActionScript 3.0 :: Globally Seach All Files In A Project?

Aug 7, 2010

I recently inherited a couple projects with half a dozen or more custom classes each. Is there a way to search across all .AS files in a project at once? It is a real drag to open and search each file one at a time.

View 3 Replies

ActionScript 3.0 :: Remove All Breakpoints In All The Code Globally?

Sep 29, 2010

I'm using CS4 and is there a way to remove all breakpoints in all the actionscript code globally. I can only remove them by going to each layer's as code.

View 0 Replies

ActionScript 3.0 :: Knowing When An Object Moved Globally?

May 5, 2011

I saw this question a few times here and there but it never had a satisfying answer... It may be that there really is no elegant way to solve this (Polling for change in ENTER_FRAME is really bad!) but I've got to ask one last time.

I'm a Flex developer but it doesn't really matter in this case.

I would like to know when an object's global x/y was modified (or its transform's concatenated matrix's tx/ty, same thing), maybe because an indirect parent somewhere moved, etc.In particular, I have the object's gran gran gran parent which gets its scrollrect changed.

View 3 Replies

ActionScript 3.0 :: Possible To Globally Set TLF Text MouseEnabled To False?

May 31, 2011

I'm wondering if you can globally set TLF Text mouseEnabled to false without having to name every text box individually?

View 4 Replies

ActionScript 2.0 :: Attach A Sound To OnRelease Globally?

Apr 7, 2004

Is there a way to attach a sound to onRelease globally?

View 7 Replies

Actionscript 3 :: Declare Variables Globally Or Within A Function Only When They Are Needed?

Jul 14, 2010

I am working with URLLoader and URLRequest in this case.

I have two buttons. One listens for the mouse click event and then runs the following function (less code not applicable to this question):

function loadURL (e:MouseEvent):void {
....
var myRequest:URLRequest=new URLRequest("*URL*");
myRequest.method=URLRequestMethod.POST;

[Code]....

The other button, when clicked, calls another function, say resetAll, that then resets the "session" by clearing out all the current variables and canceling anything currently in progress. Within that function I want to call myLoader.close(myRequest); but myLoader is not accessible from within resetAll.

In this case, should I declare var myRequest:URLRequest=new URLRequest("*URL*"); and var myLoader:URLLoader = new URLLoader(); outside of the function even if I do not need them yet?

View 3 Replies

Flex :: Way To Set Scrollbar Skin Globally In Spark Application?

Dec 21, 2011

I have a custom skin class that I want to apply to all scrollbars. Is there a way to set this globally in a Flex Spark application?

View 3 Replies

ActionScript 3.0 :: Create Globally-accessible Class Instances?

Jan 25, 2009

I created a custom class (no arguments needed for constructor) and I wanted to create an instance of that class that can be accessed by AS from aywhere inside the SWF (i.e. globally from any function or class).So far the only way I can think of doing that is to create the custom class with an associated MovieClip Symbol, drag an instance of that MovieClip Symbol to the stage, and then give it an instance name. It seems like I can then use the instance name to access that class instance anywhere.

View 4 Replies







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