AS3 Camera denied if loaded in a parent SWF - actionscript-3

I have a child SWF file that has the Camera functionality.
It works fine if I run the child SWF by itself.
However, when I load the child SWF into a parent SWF, the Camera functionality does not work.
Doing some tracing it says that Camera access is denied. That happens without me even clicking on the deny button and in fact the usual security popup does not even show up.
I have added
import flash.system.Security;
flash.system.Security.allowDomain("*");
to both parent and child SWF.
What am I missing?
It's Flash 10 player.
Thank you,
Tee

Actually I figured it out.
In the HTML file, there is this wmode: 'direct'
That screw things up.
Thanks,
Tee

Related

Adobe Flash CS6 gives me an error when importing image sequence to timeline

It will import the first 10 images but anything after that just won't work and the workspace turns completely blank and I need to restart Flash CS6.
How ever if I import the images in a new project, nothing wrong happens. I tried to export it as a swf and import that to the original swf file but it didn't work. It just imported the images that I was able to import earlier.
Is there any solution with AS3 where I can load another swf and close the current one opened? Or any other solution to importing the images.
Thanks!
but anything after that just won't work and the workspace turns completely blank and I need to restart Flash CS6
I assume you export big images, so you have out of memory in your development environment.
Do you need Image Gallery? It isn't hard to create simple image gallery, and of course you don't need to import images to the library and publish with application.
So I found out how to load a swf file, but how would I unload it/get rid of it?
If you decided to wrap your images in swf. By referencing Loader that you have used for loading swf, you could unload child SWF — Loader.unloadAndStop

Embedded SWF: Finding the framerate of the child SWF

I have a program that dynamically loads SWFs a user has uploaded to a server into another, larger, SWF. This means the embedded SWF can be any framerate and I have no control or knowledge of what is being uploaded.
What I want to do is show a message to the user that the framerate does not match the parent SWFs framerate and that it might playback too quickly or slowly.
However, when I try to find the framerate (using swfLoader.loaderInfo.frameRate) it only displays the parent's framerate, because the child's has been changed.
I need a way to find the framerate the original child SWF was set to before it was changed by the parent.
I tried going to Google for this issue, but nothing turned up a working solution to this problem.
You should use contentLoaderInfo.frameRate instead.

AS3 UILoader swf continues to play in the background

I have a simple expandable advertisement which loads an external SWF file. The external SWF file contains an embedded video.
Using the UILoader component, I have loaded the SWF, added it to the stage and the video displays and plays fine.
The main issue is that I have a close button, which should unload the video, and stop it, essentially returning to the default state of the advertisement.
To unload the SWF, I am doing the following:
myUILoader.unload();
removeChild(myUILoader);
When I do this, the video and UILoader disappear from the screen. However, you can still hear the sound in the background, and if I load the SWF again, it creates multiple tracks in the background. Any suggestions?
There are a couple of things that could cause this. One is that the content inside your UILoader is adding event listeners to outside of itself. You can fix this by not allowing it to touch anything outside itself. I believe you can do this by placing it either in its own ApplicationDomain, SecurityDomain, or both. Consult the help for more details.
If this is not feasible, you can try SoundMixer.stopAll(), which will stop the obvious symptom, but will not fix the memory leak you probably have in this situation.
Another possibility, as Ronnie has alluded to, is that you still have a reference to the content of the loader somewhere. If you don't clear that, it will stay in memory.
However, there is another problem that can also cause this, which is that if there is navigation in the movie that skips over a frame that contains a MovieClip with audio set to "stream," the MC will be created but not fully instantiated and will stay in memory with no way to get any control over it or release it. I don't think this is what is happening from your description. If it is, the fix is to make sure that you visit the frame that contains the sound, however briefly, on the way to the other frame. This is actually something you might want to consider even without sounds, because it does occur any time you skip frames in nested MovieClips (you just have no evidence unless you profile the swf), and over time this will create a memory leak.

Can a class check if it exists in an SWF or in an FLA?

I have an AS2 component which I need to behave differently in an SWF from an FLA. Can it determine its state programmatically?
Part of the problem here may be too that when I compile it as an SWC it probably doesn't think it's in an FLA anymore.
Since I need to port this to AS3 at some point, I wouldn't mind AS3 solutions too.
Unless wvxvw is correct and you're doing something with live preview, your code always runs as a swf. Swc and fla don't execute anything.
It is possible to get different behavior in different contexts. The easiest way would be to set a flag via swfobject & flashvars (when running in the browser obviously).

Adding an as2 swf to the stage in an as3 swf

I have a menu control (as2), that is completely self-contained and doesn't rely on any interaction with the parent (as3). The menu control does load an external xml file that is in the same directory as the swf.
The menu control works fine when I run it on its own. But when I import it into the Library of my as3 fla, add it the stage and run it, it just sits and does nothing.
I can see the images that are part of the control, which leads me to believe it can't load the xml, but I'm not sure.
Does anyone have any ideas about:
Loading an as2 swf into and as3 swf where they don't need to interact
Loading an external file into an swf inside of another swf
Have you tried with flash.net.Loader or if you are going for a Flex app: SWFLoader?