@@ -41,7 +41,6 @@ import haxe.Json;
41
41
import haxe .Timer ;
42
42
43
43
import openfl .utils .ByteArray ;
44
- import openfl .Vector ;
45
44
46
45
import starling .core .Starling ;
47
46
import starling .events .Event ;
@@ -52,6 +51,7 @@ import starling.textures.AtfData;
52
51
import starling .textures .Texture ;
53
52
import starling .textures .TextureAtlas ;
54
53
import starling .textures .TextureOptions ;
54
+ import starling .utils .ArrayUtil ;
55
55
56
56
/** Dispatched when all textures have been restored after a context loss. */
57
57
@:meta (Event (name = " texturesRestored" , type = " starling.events.Event" ))
@@ -152,7 +152,7 @@ class AssetManager extends EventDispatcher
152
152
@:noCompletion private var __bitmapFonts : Map <String , BitmapFont >;
153
153
154
154
/** helper objects */
155
- private static var sNames : Vector <String > = new Vector <String >();
155
+ private static var sNames : Array <String > = new Array <String >();
156
156
157
157
/** Regex for name / extension extraction from URL. */
158
158
private static var NAME_REGEX : EReg = ~/ ([^ \?\/\\ ] +? )(?:\. ([\w \- ] + ))? (?:\? . * )? $ / ;
@@ -242,19 +242,24 @@ class AssetManager extends EventDispatcher
242
242
243
243
/** Returns all textures that start with a certain string, sorted alphabetically
244
244
* (especially useful for "MovieClip"). */
245
- public function getTextures (prefix : String = " " , out : Vector <Texture >= null ): Vector <Texture >
245
+ public function getTextures (prefix : String = " " , out : Array <Texture >= null ): Array <Texture >
246
246
{
247
- if (out == null ) out = new Vector <Texture >();
247
+ if (out == null ) out = new Array <Texture >();
248
248
249
249
for (name in getTextureNames (prefix , sNames ))
250
250
out [out .length ] = getTexture (name ); // avoid 'push'
251
251
252
- sNames .length = 0 ;
252
+ #if (haxe_ver >= 4.0)
253
+ sNames .resize (0 );
254
+ #else
255
+ ArrayUtil .resize (sNames , 0 );
256
+ #end
257
+
253
258
return out ;
254
259
}
255
260
256
261
/** Returns all texture names that start with a certain string, sorted alphabetically. */
257
- public function getTextureNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
262
+ public function getTextureNames (prefix : String = " " , out : Array <String >= null ): Array <String >
258
263
{
259
264
out = getDictionaryKeys (__textures , prefix , out );
260
265
@@ -272,8 +277,8 @@ class AssetManager extends EventDispatcher
272
277
}
273
278
274
279
/** Returns all texture atlas names that start with a certain string, sorted alphabetically.
275
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
276
- public function getTextureAtlasNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
280
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
281
+ public function getTextureAtlasNames (prefix : String = " " , out : Array <String >= null ): Array <String >
277
282
{
278
283
return getDictionaryKeys (__atlases , prefix , out );
279
284
}
@@ -285,8 +290,8 @@ class AssetManager extends EventDispatcher
285
290
}
286
291
287
292
/** Returns all sound names that start with a certain string, sorted alphabetically.
288
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
289
- public function getSoundNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
293
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
294
+ public function getSoundNames (prefix : String = " " , out : Array <String >= null ): Array <String >
290
295
{
291
296
return getDictionaryKeys (__sounds , prefix , out );
292
297
}
@@ -309,8 +314,8 @@ class AssetManager extends EventDispatcher
309
314
}
310
315
311
316
/** Returns all XML names that start with a certain string, sorted alphabetically.
312
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
313
- public function getXmlNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
317
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
318
+ public function getXmlNames (prefix : String = " " , out : Array <String >= null ): Array <String >
314
319
{
315
320
return getDictionaryKeys (__xmls , prefix , out );
316
321
}
@@ -323,8 +328,8 @@ class AssetManager extends EventDispatcher
323
328
}
324
329
325
330
/** Returns all object names that start with a certain string, sorted alphabetically.
326
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
327
- public function getObjectNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
331
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
332
+ public function getObjectNames (prefix : String = " " , out : Array <String >= null ): Array <String >
328
333
{
329
334
return getDictionaryKeys (__objects , prefix , out );
330
335
}
@@ -336,8 +341,8 @@ class AssetManager extends EventDispatcher
336
341
}
337
342
338
343
/** Returns all byte array names that start with a certain string, sorted alphabetically.
339
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
340
- public function getByteArrayNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
344
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
345
+ public function getByteArrayNames (prefix : String = " " , out : Array <String >= null ): Array <String >
341
346
{
342
347
return getDictionaryKeys (__byteArrays , prefix , out );
343
348
}
@@ -349,8 +354,8 @@ class AssetManager extends EventDispatcher
349
354
}
350
355
351
356
/** Returns all bitmap fonts names that start with a certain string, sorted alphabetically.
352
- * If you pass an <code>out</code>-vector , the names will be added to that vector . */
353
- public function getBitmapFontNames (prefix : String = " " , out : Vector <String >= null ): Vector <String >
357
+ * If you pass an <code>out</code>-Array , the names will be added to that Array . */
358
+ public function getBitmapFontNames (prefix : String = " " , out : Array <String >= null ): Array <String >
354
359
{
355
360
return getDictionaryKeys (__bitmapFonts , prefix , out );
356
361
}
@@ -716,7 +721,7 @@ class AssetManager extends EventDispatcher
716
721
717
722
var i : Int ;
718
723
var canceled : Bool = false ;
719
- var xmls : Vector <Xml > = new Vector <Xml >();
724
+ var xmls : Array <Xml > = new Array <Xml >();
720
725
var assetInfos : Array <QueuedAsset > = __queue .copy ();
721
726
var assetCount : Int = __queue .length ;
722
727
var assetProgress : Array <Float > = [];
@@ -880,7 +885,7 @@ class AssetManager extends EventDispatcher
880
885
}
881
886
882
887
private function processRawAsset (name : String , rawAsset : Dynamic , options : TextureOptions ,
883
- xmls : Vector <Xml >,
888
+ xmls : Array <Xml >,
884
889
onProgress : Float -> Void , onComplete : Void -> Void ): Void
885
890
{
886
891
var canceled : Bool = false ;
@@ -1329,9 +1334,9 @@ class AssetManager extends EventDispatcher
1329
1334
}
1330
1335
1331
1336
private function getDictionaryKeys (dictionary : Map <String , Dynamic >, prefix : String = " " ,
1332
- out : Vector <String >= null ): Vector <String >
1337
+ out : Array <String >= null ): Array <String >
1333
1338
{
1334
- if (out == null ) out = new Vector <String >();
1339
+ if (out == null ) out = new Array <String >();
1335
1340
1336
1341
for (name in dictionary .keys ())
1337
1342
if (name .indexOf (prefix ) == 0 )
0 commit comments