ActionScript 3.0 :: Initialization Of Remote APIs In A MVC Pattern
Dec 3, 2010
I'm trying to buid a video player application usin the Youtube API, which is loaded remotely from their servers as described [URL]...reference.html Basically I want to add a playList via XML or flashVars which would be stored in the Model among other data taken from the video feeds of youtube by HTTP request. The issues are:
1.- I don't know where the youtube API would fit in the MVC pattern, because it has two parts, the Loader instance that you can add to the display list and the API Object itself that is more like a controller. My first approach has been to create a controller class which loads it and initiates it. But then I have to provide a reference of the loader to the View. Should I do it using a setter in the view, dispatching an event and then a listener in the view gets this reference from the controller, or including the reference in the model??? I'm a little bit lost here.
2.- On the other side, I don't know how to implement the strategy pattern betwen the view and the controller in this scenario. Should I leave the whole initialization process outside the MVC pattern? It's not that I'm obsesed with design patters, I'm just trying to learn how to use them and put myself this as an exercise: Build a videolist player for youtube so that it's easy to add, let's say Vimeo support later.
View 1 Replies
Similar Posts:
Nov 25, 2009
i'm trying to search a string for a particular pattern, and replace it with elements from within the pattern... for example..here's the given string...if you want to learn how to use regexp, {url===http://somesite.com, text===click here}.
the pattern...
{url===http://somesite.com, text===replacement text}
and the intended result...
if you want to learn how to use regexp, click here.
of course, i'll extract the url and do something else with it... i'm just wondering what the regexp is for that pattern, and how i can extract things from the results returned.
View 5 Replies
Jul 21, 2011
I am building a Flex iPhone application that in an ideal world would need to open up the iPhone SMS interface to send texts, make calls, access phone information (such as phone number) and access contact lists... I realise there isn't much in the way of accessing phone specific API's through flex at the moment, does anyone know if or when this is coming?
My main question: I seen this interesting article on extending AIR to access android APIs and was wondering if there was anything similar for accessing iOS APIs? What are people doing at the moment if you need to access iOS APIs? Is everyone waiting for an update to Flex/AIR?
View 1 Replies
Apr 29, 2009
how to use the HippoHX APIs and Classes to make a close button, fullscreen button and execute a program with arguments. I'm pretty new to as3 (started using it last week) and have absolutely no idea how it works. If you don't know what HippoHX is, you can find out at the official website.I'm asking here because i don't understand their API documentation.
View 2 Replies
Nov 23, 2010
Anyone know where I can find what Android APIs are supported in the latest Flex AIR SDK (Hero). In particular is the speech to Text API supported?
View 2 Replies
May 3, 2011
All i need to do is to invoke the soft keyboard from within my flash application. Is there anything I can do, without using a textfield or any such editable controls, which will pop up the keyboard.
View 1 Replies
Oct 11, 2011
I have a set of Flex proprietary libraries (ActionScript APIs in SWCs), and I am wondering if it is possible to build a UI completely in HTML using these APIs for functionality, rather than a Flex based UI/view. If yes, what would be the approach (or some examples)?
One reason to do so is to re-use the existing Flex (domain layer) APIs (for the short term) rather than re-writing them in say, JavaScript.
View 3 Replies
Jan 7, 2011
I would like to target a specific version of Flash Player, but don't know if I'm using any APIs, for example a movieclip property, not available in that version. Is there any way to know? The compiler doesn't seem to generate errors in this case, and I'd rather not have to resort to runtime checking. Note I am using AS2.
View 0 Replies
Mar 26, 2010
Just to confirm what I think I understand from reading about use of google APIs in RIAs (FLEX 4 and ActionScript) there is no way to connect to blogger API for example, directly from RIA because of google's crossdomain.xml file, right?
So if I want to use their APIs to get some data like content of my mailbox or list of posts on my blog I have to have some code running server side and RIA would just use that code as httpservice to collect data from google?
View 1 Replies
Oct 31, 2010
I have a flash app which will send/receive a constant stream of data. The flash app should open a connection to the Java server, keep it open, and attempt to reconnect on socket failure. Are there any good APIs that offer this functionality? Smartfox Server is one option, but if I had my way I'd embed an API in my app rather than contort my app to run under Smartfox. Ideally it would offer an API on the flash end, another on the Java end, and efficiently (java nio preferably) handle the network component in between. I would just define handlers on both the client & server.
View 1 Replies
Sep 16, 2011
A local group is mapping the relationships between board members and various organizations around my town. get some visualizations together.The visualizations focus on relationships between people and organizations eg who is on which boards and will be drawn dynamically. I am assuming I will be generating XML via PHP or Perl in order to feed the map drawing engine. [URL]
View 2 Replies
Jan 26, 2010
Once you load an actionscript page from scratch (in my case loading XML data from a file, initializing various other elements in a fairly time consuming way) if you navigate away from that page and then return to it, (via the browser 'back' key for example) is their a way to forego the previous initialization and just immediately bring up the previous Actionscript page in its fully initialized state.
View 2 Replies
Nov 7, 2010
I have created an X*Y grid of rectangles that cover up a movieclip (R). I put these into a 2d array (for easy access) and in a container movieclip which I use as mask over R. Now when I move one of the small rectangles R.width to the right when I am still in the constructor, a small bit of R will become invisible. But when I do this inside the function which handles mouse events, nothing seems to happen.
ActionScript Code:
package documentClass{
import flash.display.MovieClip;
import flash.events.Event;
[code]....
View 0 Replies
Feb 7, 2011
I installed cs5 creative suite on windows 7 64bit, I've got cs4 creative suite installed, all programs work fine, only flash cs5 has a problem, when I try to launch it, it loop after the write "I'm creating the workspace ... " (similar). It loop to infinite, I see the logo and a window with label = "flash cs5", into the window there isn't nothing, only a white page with the "cursor wait".I tried all the advise by adobe (on google cpsid_82252) but nothing work fine ... I re-installed all creative (after WinCS5Cleanupscript) but nothing ...
View 3 Replies
Jul 12, 2009
Assume you have a variety of number or int based variables that you want to be initialized to some default value. But using 0 could be problematic because 0 is meaningful and could have side affects. I have been working in Actionscript lately and have a variety of value objects with optional parameters so for most variables I set null but for numbers or ints I can't use null. An example:
package com.website.app.model.vo {
public class MyValueObject {
public function MyValueObject (
_id:String=null,
_amount:Number=0,
[Code] .....
The difficulty is that using 0 in the above code might be problematic if the value is not ever changed from its initial value. It is easy to detect if a variable has a null value. But detecting 0 may not be so easy because 0 might be a legitimate value. I want to set a default value to make the parameter optional but I also want to later detect in my code if the value was changed from its default without hard to debug side affects. I suppose I could use something like -1 for a value. I suppose it depends on the nature of the variable and the data.
View 7 Replies
Apr 19, 2010
As I currently understand, if an event listener is added to an object with useWeakReference set to true, then it is eligible for garbage collection and will be removed if and when the garbage collection does a sweep.
public function myCustomSpriteClass() //constructor {
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener, false, 0, true);
}
In this case, is it not appropriate to initialize an object with weak references event listeners, incase the garbage collector does activate a sweep removing the objects event listeners since they were added during initialization of the object? In this case, would it only be appropriate to create a type of deallocate() method which removes the event listeners before the object is nullified?
View 1 Replies
Oct 25, 2010
I am loading a component which makes a HTTPService call to get data that will then be used to set certain variables in the component. I make the HTTPService call in an init() function (for the initialization event) and then set the variables according to the data received in the HTTPService result handler. However, the variables are still null at both the initialize stage and at the creationComplete stage. If I try and read the variables in a creationComp() function (for the creationComplete event), those variables are still null. Is this correct?
I guess I don't understand the flex initialization cycle very well. When are those variables actually set and available to be used? I need to manipulate those variables automatically after the component loads. Is there an event that comes after creationComplete that is appropriate or some other way to approach this? I am using Flex 3.
View 2 Replies
Sep 16, 2010
I work mainly in C++, and at work we use this awesome autonomous singleton pattern where you automatically add statically instantiated classes to some global list. If you're familiar with c++, imagine something ala:
class CuteSingleton : public ISomeInterface
{
*** stuff ***[code]...
So basically, CuteSingleton is instantiated at DLL load time and added to a global list of ISomeInterface interfaces. This is really powerful because it lets us rapidly prototype tons of code without polluting our existing codebase by having to include these prototype files, instantiating classes like CuteSingleton in a big initializer list somewhere, etc.I've been trying to figure out how to do something similar in actionscript for a few days now and I'm coming up empty handed. All I want to do is have this code instantiate this class without having to reference it in some other files:
package EntitySystem
{
public class EntityManager extends AutoGameSystem [code].............
View 4 Replies
Feb 21, 2009
I have two questions.First: I created this class, which supposed to create sort of 3D cube
Code:
package
{
[code].....
View 3 Replies
Feb 22, 2011
Following error is arising if I use NavigatorContent in Repeater. Is there a way to initialize image and lable on which I am encountering following error: Unable to generate initialization codewithin Repeater, due to id or databinding on a component that is not a visual child.
Code:
<mx:Repeater id="rep" dataProvider="{usersArray}">
<s:NavigatorContent width="100%" height="100%" label="{rep.currentItem.name}" >
[code]....
View 1 Replies
Dec 20, 2011
I need to completely initialize a custom component in my Flex app (i.e. I should be able to access it from action script and get its properties and its children etc), But I do not want to add it to the display or make it visible. I have tried to add it to my visible component, but keep it visible, but often many of its properties are set only when it is drawn, so i don't get what i need. Is there a way to add a custom component to some sort of 'Virtual' display, that is not visible to the user?
View 3 Replies
Apr 27, 2006
So I have a movieclip that I want to play nice with my class file. So I set the linkage and all that and it works. But, my initialization function gets called with no parameters, because I have not set any. How do I do that with this method?
I've tried something like:
Code:
import tab;
tab1_mc = new tab("left", 5, 55, "testclip.swf", 0);
And that sets the parameters, but not before the linkage on the MovieClip fires. how to get the best of both worlds?
View 7 Replies
Mar 3, 2011
My Flex application (SWF) initialization takes 25 second to load 1.6mb SWF in widescreen monitor. The same SWF loads pretty fast (3 Sec) in Flat panel monitor 1024x768 resolution. What is the reason for +/- in rendering speed , +/- in CPU utilization on different monitors , screen resolution.
note: my internet sepped is 10+ mbps broadband.
View 1 Replies
May 27, 2011
I am trying to write a simple multicore PureMVC helloword. I am getting Error: multitonKey for this Notifier not yet initialized!
[Code]....
View 1 Replies
Jun 7, 2011
I have a Spark list with a customItemRenderer that is taking a good 3 seconds to initialize with just 50 items.
I'm using Flex 4.5, my ItemRenderer is already very optimized, using as little nesting as possible, fxg and so on.
Is anyone having similar issues? I've tried almost everything in the book bar going back to mx.
View 3 Replies
Sep 3, 2009
The jist of what I'd like to know and focus on understanding, is details on how binary deserialization occurs in Flex 3. When is the constructor called, when are properties set, are private members serialized or does all deserialization occur on and through setters, etc? I'm having a hard time finding information on this.In a Flex 3 AIR application, I have a pretty complex object graph(just a bunch of objects referencing one another, kinda like a big data model except a bit more complex) that I serialize to a file using a single call on the FileStream.writeObject and readObject on a root object, which serializes and deserializes the entire object graph.I found that I needed to always have a default constructor, else I would get exceptions on the objects when deserializing if they were part of an ArrayCollection. So I had to eleminate the constructor parameters or set default values. I now have many setters like this in my classes, such as the below where mConnection accumulates some information it needs through different setters, where as before I had this all packed into the constructor since all of the information is really necesary for the Connection to function:[code]So the connection's serverIP is still an empty string because the server was assigned to the client's property before the server was completely initialized.
I could probably resolve this by using binding so that updates to the serverip in the server are bound to the connection, but I find binding properties to be fairly complicated (it's really simple on UI in mxml cause you just use the curly bracket syntax but doing it by code is what I found complicated). I have also resolved some cases by removing the constructor parameters entirely, so that there is no default values. All that aside, I still really need a deeper understanding of the details of binary serialization as far as how it rebuilds the object graph. I even have circular references, and it seems to handle those fine and maintain multiple references without duplicating objects. It's just when my constructors/setters are more complex that I'm running into these problems because of the order of what occurs during deserialization. It is really inconsistent though, as adding breakpoints in various places seems to influence the order that things occur, making it more difficult to debug.On a side note for anyone that might sidetrack the topic because I am serializing a class called Connection. I added some code to address some things, like in the Connection class there is an instance of a Socket. Of course my socket would not be connected after I close and reopen the application and deserialize it, so before I serialize my object graph, I go through and close the socket and set the reference in the Connection class to null, so that there is no longer a reference to the socket and thus it will not get serialized. After deserialization on the next application run I create a new socket.
View 1 Replies
Jan 25, 2012
I am working on a server push from Java to Flex. But some how the MessageBrokerServlet is not getting initialized, seems like it is calling a method from: flex.messaging.config.LoginCommandSettings.setMatch() Eventually I found out that this method indeed does not exist in that class (LoginCommandSettings). I there something else that is going wrong?
[Code]....
View 1 Replies
Dec 5, 2005
I initialize the "point" object like:
point = {x:'209', y:'270'};
trace(point.x);
this is working fine, But I have to initialize the "point" object with a string variable which holds the initialization properties like:
[Code]...
I know this is not working. Is there any method to initialize the object with a string variable which holds the initialization properties (without parsing the text) ?
View 7 Replies
Apr 16, 2010
I'm getting an odd error from my composite canvas component: An ActionScript error has occurred:
[Code]...
It seems to be related to the fact that my composite component has a child and I'm trying to add one in the place I'm using the component. So how can I do this correctly? omponent code looks like this (EditableCanvas.mxml):
[Code]...
View 2 Replies
May 10, 2011
I've got a component written for my app by a third party developer and am trying to integrate it, but I've found a bug that seems like it's either a compiler bug, or there's something with how Flex and static variables work that I wasn't aware of.Basically, I have this:
public class ModeChangeController {
public static const DISPLAY_MODE:String = "DisplayMode";
}[code]...
If I use //V2 (i.e. comment out V1), a bug occurs at the startup of the application (some TextFields are uneditable and contains no text), but with //V1 and not V2, it works fine. If I comment out both, that also works fine (I don't get the TextField bug).It took me a while to figure out that it was that static const String that was causing the issue, but I'm still not sure why or if there's something I can do about it except for just moving the DISPLAY_MODE to Events (which is what I've done at the moment, but it's not a particularly nice solution).There are no errors in the log. The order of the includes in my BorderContainer code doesn't matter. I've googled for "as3/flex static initialization order" but haven't found anything.
Clarification: showInitialView() never gets called. It doesn't get there before the other bug shows up. Just having the V2 line there causes the problem.
Update: I've fixed my problem with the TextInput strings not showing: Turns out that adding the component caused the Tahoma font to not show up. However, setting the font-weight to bold fixed that problem, or switching to Arial. With that said, the original question still stands, because when I ran it without V2, it found Tahoma with normal font-weight.
View 1 Replies