Open the source FLA file, select the asset in library then click properties, ensure export in frame 1 is selected.
A known Flash CS4 issue, create a new FLA and copy all library asset into the new FLA and re-publish.
Change stage size in the source FLA asset to a smaller size eg. 640x480.
Close unity and uniSWF then restart unity, optionally try manually starting uniSWF from the programs/application menu.
Quit the uniSWF application and re-export the last file again.
Set the compression in the publish settings in the source FLA to 100% File->Publish Setting->Flash(tab)->JPEG Quality to 100%
Known Flash CS 4 issue when exported symbols changed from a SimpleButton to MovieClip in the Symbol Properties window, the solution is to remove the symbol and copy its contents into a new MovieClip or SimpleButton or export in CS 5 or above. To find the corrupted symbols check the Symbols name under the Source section at the bottom of the Symbol Properties window, this normally should be blank.
Try changing the anti-alias type to Bitmap text [no anti-alias].
Backup your project first, remove MonoManager.asset and the ScriptAssemblies/ folder in the /Library of the startup/current project.
Known issue with large textures, first, ensure the exported texture dimensions are a sufficient size, this is set by selecting the swf file and accessing the uniSWF export options, adjust Texture output size accordingly. If the issue persists, locate the exported texture in the Resources folder and select it, and in the inspector click on "Texture Type" and select "Advanced", change filter mode to "Point" and apply changes.
Movieclips with Filter effects are best put into one fla and exported with "Exported nested MovieClips" feature checked off. Make sure the movieclip with the filter effect is inside a holding Movieclip (make sure the linkage is exported) and ensure the movieclip within the holding clip( the one with the filter applied) is NOT exported.
Select the textures in the resource folder and change the wrap mode to clamp, this is due to a known issue when doing UV rounding and scaling down, this will be resolve shortly in a future version.
Failing that try making the texture size bigger.
Try making the asset smaller so it fits into the texture size.
Export all child animations as Movieclips.
Embed characters using the Export options->fonts->charset/embed characters
Currently not supported but a work around is possible by the following shader, please note this will create some warnings in the console due to missing normals which will be resolved in future releases, also doesn't support alpha blending very well so try to keep everything in a rectangle:
Shader "uniSWF/Transparent/DiffuseTexDoubeSidedAlphaGlobalFogCompat" {
/*
Test shader for use with global fog and DOF.
Notes:
- will generate a load of "Shader wants normals, but the mesh doesn't have them" until lib is updated with normals enabled.
- This will apply to any overlays, future versions will have separate shaders
*/
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float4 color: Color; // Vertex color
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb * IN.color.rgb * 4;
o.Alpha = c.a * IN.color.a;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
Know issue with older version of flash, creates incompatible swf's caused by one or more bad asset references in the library. A solution is to isolate the bad asset in the FLA by doing the following work flow:
- Create a new Actionscript 3 fla document ( file->new )
- Copy a single export to the library in the new fla
- Save and publush
- Check if symbol shows in unity ( Window->uniSWF->Swf URi Browser )
- If the symbols shows then copy another
- Repeat until none or some of the exports go missing, once encounted do the following
- Remove a layer, then publish
- Do the same until all the symbols re-appear
- That is the offending layer/asset, consider removing, re-importing or recreating it.
As of uniSWF 1.0.2 and below the MovieClip player will remove any DisplayObjects that are not part of the exported asset ( even if no assets are assigned ), the solution is to call MovieClip.stop(), If animation is used then you will need to re-add the objects every frame. If you don't require any exported asset support use the DisplayObjectContainer as a alternative.
First make sure the Air app (uniSwf/installer/uniSWF.air) is installed. uniSWF assumes its installed in the /Applications folder on a mac and in c:/Program Files on XP and c:/Program files(x86) on vista/win7. If you are using a custom install path go window->uniSWF->Export Options, then expand the preferences section and browse for the "uniSWF Converter" application installed from the "uniSWF.air" installer.
For the trial version the paths will be "C:/Program Files (x86)/uniSWF Converter Trial/uniSWF Converter Trial.exe" for windows and "/Applications/uniSWF Converter Trial.app" for OSX
Possible cause is when DisplayObjects above the button are absorbing the click, one common issue is when a screen fade overlay is set to 0% alpha, to resolve this is to set the visible=false or clear the keyframe when it gets to 0%.
Caused by a possibly corrupt swf file from CS4, simply select all the assets in the library and paste into a new FLA, overwrite the original file once everything works.
Issue will be resolved in future versions, a quick fix is to replace the contents of shader "uniSWF-Double-Alpha-Diffuse" with the following:
Shader "Transparent/DiffuseDoubeSided" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off ZWrite Off Fog { Color (0,0,0,0) }
Lighting Off
Material { Emission [_Color] }
ColorMaterial AmbientAndDiffuse
SubShader {
Pass {
SetTexture [_MainTex] {
combine texture * primary
}
}
}
}
}
Currently uniSWF doesn't handle text input by default but there is a way to add this on a per text field basis using the following code.
There are two input fields called "user_txt" and "pass_txt" used for a simple login form, change these to the textfield names you require input on. The FocusEvent will be listened on to trigger the touch keyboard, once focused the text will be captured from the TouchScreenKeyboard to the TextField.
This has been tested on iOS and Android and will be merged into the main uniSWF package in future updates.
#pragma strict
import pumpkin.display;
import pumpkin.text;
import pumpkin.events;
var activeInput:TextField = null;
var prevTest:String = "";
var keyboardType:TouchScreenKeyboardType = TouchScreenKeyboardType.Default ;
private var keyboard : TouchScreenKeyboard;
private var lastTxt:String;
private var stage:Stage ;
function Start () {
stage = GetComponent(MovieClipOverlayCameraBehaviour).stage;
var mc:MovieClip = new MovieClip( "swf/menu_wireframes.swf:Login" );
stage.addChild(mc);
// Get texfield and listen for focus change events
var user_txt:TextField = mc.getChildByName.<TextField>("user_txt");
user_txt.addEventListener( FocusEvent.FOCUS_IN, onFocusIn );
user_txt.addEventListener( FocusEvent.FOCUS_OUT, onFocusOut );
var pass_txt:TextField = mc.getChildByName.<TextField>("pass_txt");
pass_txt.addEventListener( FocusEvent.FOCUS_IN, onFocusIn );
pass_txt.addEventListener( FocusEvent.FOCUS_OUT, onFocusOut );
Input.imeCompositionMode = IMECompositionMode.On;
}
function onFocusIn( e:FocusEvent ) {
var txt:TextField = e.currentTarget as TextField;
// Set text for input change detection
prevTest = txt.text;
lastTxt = prevTest;
// Open keyboard on focus change
keyboard = TouchScreenKeyboard.Open(prevTest, keyboardType );
activeInput = txt;
}
function onFocusOut( e:FocusEvent ) {
var txt:TextField = e.currentTarget as TextField;
// Clear target on focus change
activeInput = null;
keyboard = null;
}
function Update() {
// Check target field
if( keyboard != null && activeInput != null ) {
// Detect keyboard close
if( !keyboard.active ) {
// Set final value
activeInput.text = keyboard.text;
// Clear keyboard
keyboard = null;
// Clear focus
stage.focus = null;
} else {
// Check input change
if( keyboard.text != lastTxt ) {
// Update text field
lastTxt = keyboard.text;
activeInput.text = lastTxt;
}
}
}
}
UniSWF doesnt support AS3 as you need to port your code to UnityScript, the Error #1065 is an actionscript error, try removing any ActionScript from the timeline and remove any main classes.
Known issue due to the ray test returns 0,0 when clicking outside the collider, which in turn fires events on any sprite that exists under the x:0,y:0 position.
One possible solution is to make sure no objects exist under the x:0,y:0 position on the stage ( global space ), Another way is to override the input handler to detect if the mouse is inside the collider, see below:
This has been fixed in version 1.0.3beta. Also this issue doesn't exist with the MovieClipOverlayCameraBehaviour so maybe consider using that instead if the UI is overlay based.
#pragma strict
import pumpkin.display;
import pumpkin.events;
class MovieClipBehaivourOutOfColliderMouseBug extends InteractiveMovieClipBehaviour {
function OnStart () {
var mc:MovieClip = new MovieClip( "swf/button.swf:button" );
mc.stopAll();
mc.addEventListener( MouseEvent.CLICK,function(e:MouseEvent) {
Debug.Log("Click");
});
stage.addChild(mc);
}
function Update () {
super.Update();
}
override function handleUserInput() {
if( collider ) {
var cam:Camera = mouseInputCamera != null ? mouseInputCamera : findMainCamera();
var ray:Ray = cam.ScreenPointToRay(Input.mousePosition); // create ray from mouse coord
var info:RaycastHit ;
if(!collider.Raycast(ray,info, 99999)) // perform hit test
{
return;
}
}
super.handleUserInput( );
}
}
The SpriteSheetMovieClipBehaviour manages the AnimSpriteSheet class for general use in Unity. The AnimSpriteSheet converts MovieClips into a pre-allocated static Mesh, it then moves the mesh points into place for each frame for example if frame 1 of the MovieClip has 100 sprites and frame 2 had 1 sprite, the mesh will still contain 600 points but on frame two 594 of the points will be moved to zero. One of the main advantages using this class is to remove the overhead of the MovieClip player class during run time.
The following code creates a sprite sheet and stops on frame 1, you can also create and configure the SpriteSheetMovieClipBehaviour through the Unity property inspector.
using UnityEngine; using System.Collections;
public class SpriteSheetBehaviourTest : MonoBehaviour {
void Start () {
GameObject go = new GameObject();
SpriteSheetMovieClipBehaviour spriteSheet = go.AddComponent<SpriteSheetMovieClipBehaviour>();
spriteSheet.movieClip = "swf/movieclip/char_1.swf"; // Movieclip name
spriteSheet.symbolName = "char1_legs_N"; // Export name
spriteSheet.Awake(); // Refresh
spriteSheet.spriteSheet.stop();
spriteSheet.spriteSheet.setFrame( 1 );
}
}
Select the .swf file in the project view, then go window -> uniSWF -> Export options and you should see this:
Then expand fonts and character sets, you should see CJK Unified Ideograph, enable this to export common japanese and korean characters in fonts that are in that swf.
To add extra characters such as CJK punchations ( http://unicode.org/charts/PDF/U3000.pdf you need add to the "Embed unicode range" eg. 4E00-9FFF,3008-300B to add 〈 》punchuation marks.
Ensure 3D transform are not used in any animation as uniSWF does not support this feature. To check open flash, select the object then open the transform window ( Window->Transform) and click the "Reset transform" button.
Known issues with CS4 FLA corruption, to resolve simply select all exported symbols in the Library and copy them into a new FLA document.
Please refer to the following link:
http://uniswf.com/home/manual/sectionName/Unity%20Version%20Compatibility::Unity%204.2%20Issues
Flash 11 is not currently supported. Change the flash target version to 10.0 or the nearest 10.x version. Go File->Publish settings and change the Target drop down list.
In Flash ensure all fonts are embedded and there are no compile errors, to note compile errors will not trigger if there are font any embed warnings.
This is caused by the windows firewall blocking the uniSWF communication socket, to resolve the issue do the following:
Close Unity.
Reset the windows firewall: http://windows.microsoft.com/en-gb/windows7/restore-windows-firewall-settings
Open the uniSWF converter ( from start menu or ProgramFiles/Uniswf Converter etc )
Click Allow network access when prompted by the windows firewall;.
Open Unity
Window->uniSWF->Welcome
This should display the uniSWF converter application installed message.
The uniSWF API was updated to remove Hash tables for WP8 compatibility, to resolve this you will need to convert the Boo.Lang.Hash/Hashtable arg to a Dictionary<string,object>, the easy way to do this is to use the Tweener.Hash().
previous method
Tweener.addTween( mc, { "x": 100, "y": 200 } )
current method:
Tweener.addTween( mc, Tweener.hash( "x", 100, "y", 200 ) )
Currently Shape tweens are not supported. There is a work around to this, you can convert shape tweens to vector shapes by selecting the frame range of the shape tween, right click and select "Convert to Frame-by-Frame Animation".
This was caused due to the certificate expiration of the converter application in 2.0.4 and below, please install a later version 2.0.6 or above.