ActionScript 2.0 :: Possible To "inject" Data In Compiled SWF?
Jun 28, 2010i was wondering if its possible in any way to add/inject a variable, WITHOUT having to decompile/recompile a SWF
View 5 Repliesi was wondering if its possible in any way to add/inject a variable, WITHOUT having to decompile/recompile a SWF
View 5 RepliesIs it possible to inject data, for example a collection of assets (video, images...), in an swf at compile time?
We have a flex application that needs to be able to export an swf at runtime that contains all the necessary data, because it needs to run as a standalone application (on- and offline).
The idea so far was to create a server side script that calls the flex compiler and feed it the data it needs. This approach seems to work fine using the [Embed] tag for single files, but it gets kind of messy when trying to inject collections of data that vary in length for each exported swf.
We could generate an mxml file with one embedded variable for each asset and include it at compile time, but that approach seems for from ideal.
We've looked into some actionscript bytecode libraries, but those do not seem to be fit for this.
I compiled a simple AS3 project using Flex 3.5 (also tried Flex 4.1) to create a small swf which draws a simple red square on screen. Nothing too complex that requires special flashplayer support (see code below)
package
{
import flash.display.Sprite;
/**
[Code]....
and tried to load it into a AS2 swf I have compiled using Flash CS4. But that just didn't work. I don't get any errors when loading and the AS2 swf can load any swf, either compiled in AS2 or AS3 by Flash.
I am working on a feature for an application that requires Flex 4 functionality. Due to some migration issues of the application from Flex 3.5 to 4.0, I have decided to implement this feature as a module that is compiled with Flex 4.0. The theory is that the application would remain compiled in Flex 3.5 and load the module when it needs it.[code]
View 1 RepliesI have a controller that receives an event with some data. As a part of the processing this s new data it needs to modify a collection in another controller. Is it a bad idea to inject a controller into another controller to modify this collection?
View 2 RepliesI was wondering how do you inject metadata into an f4v file with quepoints? I've been reading somewhere that it's either during encoding or a custom actionscript that embeds when the file runs.
View 1 RepliesI was wondering wether it is possible to inject a frame script into a MovieClip and to get a reference to the mc the script was injected into from the function used as the frame script.There is a MovieClip named mc. It has a frame label 'end' somewhere and we want to add a stop() to that frame without adding code to the MovieClip itself (keep in mind that this is just an example). So here is the code (we could place it on the main time line of a test movie that has the mc on the stage):
var end:int=0;
for (var i:int=0;i<mc.currentLabels.length;i++)
{
if (mc.currentLabels[i].name=='end')
end=mc.currentLabels[i].frame;
[code]....
When the playhead reaches the frame labeled "end" in mc the function doStop() will execute. This function keeps its original scope however. So to stop the mc we need to specify mc.stop(). 'this' points to the object where the function doStop resides so this.stop() won't work. If we wanted to use the same function for multiple mcs we'd have to get a reference to the currently targeted mc somehow.
Is it a bad idea to inject data into an itemrenderer. The reason I ask this is because the state of each item is dependent on different changing data sources. So the original data is used to just display a new item, but there could be two to three other data collections that would be needed to determine the item's behavior. Is there a better way to do this? Should I be creating a custom DataGroup with the other data sources as properties on this custom container and then reference the data sources from the itemrenderer to the parent?
View 1 RepliesIn my parsley container, I'm instantiating an object 'A' that contains a Dictionary (flash.utils.Dictionary).
I would like to create this Dictionary using parsley and inject it to 'A'.
This dictionary pairs structure is: key=id of object 'B', value='B'
where object 'B' is also an object which is defined and created using parsley(so basically the pairs structure is and object id as a key and the object itself as the value).
Now, I have no problem creating 'A' and 'B', but can't seem to find the right way to create this dictionary using parsley, nor injecting it to 'A'.
With regular HTML it's possible to change the look of the page and to make new cookies using javascript simply by typing it into the address bar and hitting enter.But what about flash videos.Is there a way to preform some action on the video on the page using javascript in the address bar?
View 2 RepliesI'm designing a game where the levels are too big to be in one swf. so each level loads up a new movie- but if my wildest dreams came true i would be able to, for example, load level 2 and have it remember how well you did on level 1.is there any way to do this? to inject a variable from the first movie to the second one after it takes over?
View 3 Repliesi am working in a flex application, i have an mx text control or I can use whatever control I need to do display the text value, but what I am trying to accomplish is to be able to format that text value with html 'before' it gets bound to the text control.<mx:Text text="{data.combinedCriteria}" width="99%">In the .as file that manipulates the combinedCriteria property of data,
View 1 Repliesim wondering how this code is interpretet/run by flash as3.Lets say i have a for loop:
for ( var i:Number = 0; i < 12; i++)
{
runStep1();
[code].....
I have had this problem a few times lately. When I try to update & publish files that I created in the same version of Flash CS3 and previously published fine, the "Exporting Flash Movie" bar comes up, but no movie compiles. When I go to look for the swf in the Finder (Mac OS 10.5.7), it has mysteriously disappeared, and only the .FLA remains.
It doesn't happen with ALL files I publish, only some -- so I know the SWF preview should come up automatically. I normally work off of a shared network drive, but the same thing happens on my local machine. Has this happened to anyone else?? Is there a cache I need to clear or something?
Is there a simple way for me to add this to an already compiled swf?
View 2 RepliesI would just want to know if someone know what it's about and how to work around in on XP 64-bit.I've got my ActionScript-program to work on all the different computers I could find and with all versions of IE with IETester. However the guy I was doing it for kept getting a problem when he was uploading files. My upload file-part looks almost exactly like the final example in the FileReference Adobe livedocs:URL...I'm pretty sure he got a HTTPStatusEvent that stopped uploading, though I didn't have a warning for that but I had for the different errors and the rest are just signaling when it's canceled, done, and the progress. HTTPStatusEvent is the only one I'm not entirely sure what it's doing so I think that's the one. Though Googling that didn't solve my problem.Anyway I found some machines with Windows XP 32-bit and seemed to get his problem when using Internet Explorer, though Mozilla was always fine (the guy with the problem was only using IE). I tried shutting down firewalls and changing the settings in IE without any difference so I installed Adobe Flash on one of the computers with Windows XP 32-bit, compiled and uploaded the new swf-file and it works on Windows XP 32-bit. Also on Vista 32-bit it always works with both IE and Mozilla.
These computers with 32-bit and 64-bit XP are several hours with bus apart so I can't do any quick tests (like printing a warning for the HTTPStatusEvent compiled on XP 64-bit, sorry). I Googled for problems with 32-bit and 64-bit XP but I couldn't find anything, with ActionScript 3 that is. It was the common hysteria that 32-bit programs don't work on 64-bit systems that made me re-compile my program, but this was the opposite.Does it seem likely this was even the problem? Have anyone ever had a similar problem? This might also be more of a Adobe Flash-problem, but everything except the FileReference part works.
I've been messing around with SWF Decompiler's latest and found that my Flex3 project's main MXML file is found verbatim in the SWF (in addition to the compiled class). How can I make sure this is not included?
View 8 RepliesI have found a bug in flash CS5, I was wondering if anyone else had this? This bug occurs in Flash CS5 when creating compiled clips which use the 3D rotation tool. It appears that if you attempt to convert a symbol which contains a 3D transformation to a compiled clip it will not work correctly. What makes this problem worse is that the error is not reported correctly and so it is nearly impossible to debug.
[Code]...
I am building a swc [MY.swc] component with compc. It is suppose to contain base functionality for MY.swfI need to include another (third party) swc [OTHER.swc] into my own swc. This other swc has a reference to mx.core.mx_internal and I suspect that it is this reference that in the end, when I compile MY.swf, results in that all mx classes (mx.*) and all spark classes (spark.*) is included in MY.swf (seen when decompiling)The difference in size between MY.swf with/without OTHER.swc is ~180kB.The only difference (when decompiling) MY.swc with/without OTHER.swc is that the first has a reference to mx.core.mx_internal
Here is the compc part from my ANT task:
<compc output="MY.swc">
<include-sources dir="${project.root}/${SRC_ROOT}" includes="*" />
[code].....
It's a great thing that it's possible to compile an SWF into iOS native app. I think AIR is now the best option to write e.g. small games or interactive books. Of cause AIR app will be slowler than the same app written on e.g. objective C. The question is how slower AIR app will be. Can simple AIR apps be launched e.g.on iPhone 3G or iPAd 1?
And another question is, can arbitrary flash app be compiled into iOS native app?
Im using Flash Builder 4 on the Mac and I have a worrisome problem: The compiler is sometimes not detecting my code changes.For example I might write some code, compile and run, then add some logging statements, but they will not print. After a clean compile everything runs as expected.I cannot see a pattern to the exclusion of changes. I'm wondering if anyone else is having the same problem?
Details:
Flash Bulider 4 Pure AS3 project targetting Flex3.5 SDK Max OS X Snow Leopard My code does not use semicolons to terminate statements
Can I really do that with the phone? Perhaps I would have to call any of the native API's, but I am not really sure whether and what is possible. I am pretty sure that the camera is accessible, so at the worst case I could send the picture to the server, decode the QR code on the server, and get the results on the phone, right ?
View 1 RepliesI just noticed my size report includes the following:
ActionScript Bytes Location
------------------ --------
294323 ActionScript 3.0 Classes
This seems like a lot for what is essentially byte code. I'm not using any images. I have vector art in there but it's mostly straight line geometric stuff, no complicated wiggly art or anything. I'm not using any Components.My entire codebase comes in at 167k of Actionscript. So how can I be using 294k of byte code?
I have a Flash Professional CS5 project with ActionScript 3. I have a movieclip object with several gotoAndPlay ActionScript commands inside of it. I also have other gotoAndPlay commands on the main stage, linked to interactive events.
When I run the project via Ctrl+Enter, it works perfectly, without any issues. However, once I compile it down to a .swf or an Air 3.0 file, it runs, but omits some or all of the gotoAndPlay commands, both the ones inside of and outside of the stage.
I have the most weirdest problem with Flash Player and FlashDevelop (to be honest, dont know which one causes it), so let me explain. I have recently downloaded FlashDevelop and created an AS3 Project. When I compile the project, the files are generated in the bin folder. Now, when I navigate to the bin folder and open the index.html in Firefox and IE9, everything works fine. However, when I copy the bin folder somewhere else and then try to do the same, i can see the flash movie in Firefox but not IE9.
View 1 RepliesI'm using Flash cs3. I have an as3 file next to my fla file which contains all the specific actionscript for that file. Then, through the source path in the fla's "Publish" settings I am pointing to an external folder with all the other necessary classes.When I press control + enter to compile the file it works fine. But when I try to see the published file embedded in a webpage on another computer, the swf won't display in either chrome or firefox. It will display in IE though. If I copy all the actionscript files into the same folder as the swf, the swf will display in all browsers. Is there no way to have the script in external as files to compile into the published swf file?
View 6 RepliesI can bind in an AS3 project fine--just import the classes and it works as it does in Flex. Not so with a fla. The first binding works, but not after. I'm assuming this is because the compiler is not mxmlc and does not write code when it reads the bindable metadata tags, so no property change events are fired when a value changes. So, no real binding.
View 1 RepliesIve been working for about 4 weeks on a little flash app which uses sockets (not xml sockets) to connect to [URL]. When i was building the code it succefully connected many times to the server (veryfied through network traffic viewing) without using loadPolicyFile method. However when i compile and run the sfw it generates no network traffic,
I've now tried adding Security.loadPolicyFile("ht tp://www.youtube.com/crossdomain.xml"); which does not even generate network traffic when i preview the movie hitting Ctrl + Intro in the compiler. So i ask, does this method really work?, whats wrong with it?
I was considering the fact that the internal flash player of the compiler allows internet connections but the Shockwave Flash plugin (10.2.159.1) does not, at least not the way im trying to.
To be considered:
- Builded in Flash CS3 Professional.
- sfw was loaded in an local html file and run by Mozilla Firefox 4.0.1.
I just found out that it is executed like a normal variable at runtime. Typically constants are supposed to be 'inlined'........ so when you write this:
ActionScript Code:
const SPEED:int = 5;
o.x += SPEED;
...you should get this in the SWF:
ActionScript Code:
o.x += 5;
...but when I decompile my SWF I get this:
ActionScript Code:
const SPEED:int = 5;
o.x += SPEED;
Is there a way to force the Flex compiler to inline constants in AS3?
I have an actionscript-only project in Flex2 and I would like to set width and height of the compiled swf.
View 1 Replies